---
title: "buy_credits"
description: "Generated reference for the management action buy_credits: its description, access metadata, payload contract, and registration status."
slug: /reference/actions/buy-credits
order: 5
visibility: public
redirects_from: []
---

# buy\_credits

Generated automatically from the [published contract sources](/cloud/reference/about/#contract-sources).

A script calls this action over HTTPS at `POST https://dev.turnzero.ai/api/v1/buy_credits`, with a bearer credential and the action's payload as the JSON body. An MCP connection lists this action as the tool `buy_credits`.

OAuth access tokens and minted tokens, including the turnzero command's computer token, are bearer credentials. The action determines which kinds, scopes and grants it accepts ([Sign-in, sessions, and tokens](/cloud/concepts/sign-in-sessions-and-tokens/)).

**Build metadata:** Registered in this build. Registration describes the default dispatcher in this build. It does not guarantee that a caller has the required credential or grant, that a tool is listed for that connection, or that the required service is configured.

## Contract description

On the Cloud MCP connection, request a link to the site's Add credits page with the amount chosen\. The call checks purchase eligibility and limits\. The owner opens the link and selects Continue to checkout\. The site makes the remaining checks\. This call opens no checkout, pays nothing and grants no prepaid credit\.

## More about this action

Pass an amount from the request's enumeration, in whole US dollars\. The call reads only your connection's account\. It writes no purchase, opens and ends no checkout, and asks the payment provider nothing\. Repeating it starts no purchase\.

The call first checks sales, purchase routes and the listed amount, in that order\. A missing account refuses authentication\_required\. Next, purchase\_not\_admitted refuses an unbilled account, an account blocked after a refund or dispute, or one with an open dispute\. On a test\-mode site, a synthetic or operator account alone is admitted\. The account's UTC\-day purchase limit is checked next, then its hourly limit on starts\. These checks run in the purchase act's order and words, before any link is returned\.

The UTC day's limit counts the account's purchases paid that day, in any later state, plus the amount requested\. Unpaid purchases are excluded\. The limit depends on the account's age\. An account with ten or more starts in the preceding hour refuses purchase\_rate\_limited\. An ended checkout paid later still grants credit, which can take the day over its limit\.

The response gives amount, currency and add\_credits\_url: the site's Add credits page with that amount chosen\. Ask the account owner to open add\_credits\_url, sign in, review the amount and select Continue to checkout\. The site repeats purchase admission and makes the remaining checks\. These include the provider's price, the locked recount of starts when writing the purchase, checkout's opening and whether another start replaced it\. Any of these can refuse the site's call\. If admitted, the site sends the owner to pay on the provider's page\. Turn Zero is the seller\. No tax is added at checkout; tax is taken from credit as it is used\. This call pays nothing and grants no prepaid credit\.

A verified paid event must identify the platform's purchase and match its amount before tax and US dollar currency\. Where the purchase already holds a provider session, the event must name it\. Both paid event kinds must report paid\. An unpaid completion grants nothing until paid; a failed or abandoned checkout grants nothing\. The grant expires from the payment event's own instant, not from checkout's start\. A repeat of the same paid event grants nothing again\.

## Access and action metadata

```json
{
  "name": "buy_credits",
  "resource": "account",
  "tier": "reversible",
  "surface": "account",
  "addresses": [
    "tzcloud",
    "tztools"
  ],
  "clients": [
    "bearer",
    "browser_session"
  ],
  "summary": "Request prepaid credit for the account. Over MCP the call checks purchase eligibility and limits before returning the site's Add credits link with the amount chosen. It opens no checkout. The owner opens the link and selects Continue to checkout. The site repeats admission and makes the remaining checks that need a provider call or a write. From the site's Add credits page or the HTTP action route, the call starts a purchase. The response includes the provider's checkout link. If prepaid credit sales are off on this site, the call refuses. The response grants no prepaid credit.",
  "annotations": {
    "readOnlyHint": true,
    "destructiveHint": false,
    "openWorldHint": false,
    "idempotentHint": true
  }
}
```

## MCP catalog entry

```json
{
  "name": "buy_credits",
  "title": "Link to add prepaid credit",
  "tier": "reversible",
  "scenario": "CHI-L0-04",
  "summary": "On the Cloud MCP connection, request a link to the site's Add credits page with the amount chosen. The call checks purchase eligibility and limits. The owner opens the link and selects Continue to checkout. The site makes the remaining checks. This call opens no checkout, pays nothing and grants no prepaid credit.",
  "owners": [
    "ACB-L0-101",
    "ACB-L0-102"
  ]
}
```

## request

| JSON pointer | Description and constraints |
|---|---|
| "" \(root\) | Type: object<br>Required fields: \["amount"\]<br>Additional properties: false |
| /<wbr>properties/<wbr>amount | The prepaid credit to buy, in whole US dollars\. Use one of this member's enumerated amounts\.<br><br>Type: integer<br>Allowed values: \[25,50,100,250\] |

## response

| JSON pointer | Description and constraints |
|---|---|
| "" \(root\) | Type: object<br>Required fields: \["contract\_version","amount","currency","detail"\] |
| /<wbr>anyOf/<wbr>0 | Required fields: \["purchase","state","checkout\_url"\] |
| /<wbr>anyOf/<wbr>1 | Required fields: \["add\_credits\_url"\] |
| /<wbr>properties/<wbr>contract\_version | Required value: 1 |
| /<wbr>properties/<wbr>reference | The short reference the platform recorded your call under: ten lowercase hexadecimal characters, the value in the call’s record row\. Quote it when you report the call\.<br><br>Type: string<br>Pattern: ^\[0\-9a\-f\]\{10\}$ |
| /<wbr>properties/<wbr>purchase | The purchase id generated by the platform\. It identifies no account\. Absent over MCP, where the call starts no purchase\.<br><br>Type: string<br>Pattern: ^pur\_\[0\-9a\-f\]\{32\}$ |
| /<wbr>properties/<wbr>amount | The prepaid credit requested, in whole US dollars, before any tax\.<br><br>Type: integer |
| /<wbr>properties/<wbr>currency | The currency of the prepaid credit requested, US dollars\.<br><br>Required value: usd |
| /<wbr>properties/<wbr>state | Checkout was opened\. This state does not say payment was made or prepaid credit was granted\. Absent over MCP\.<br><br>Required value: started |
| /<wbr>properties/<wbr>checkout\_url | The payment provider's checkout address, returned outside MCP\. The site's Add credits page sends the account owner there to pay\. Absent over MCP\.<br><br>Type: string<br>Format: uri |
| /<wbr>properties/<wbr>add\_credits\_url | Over MCP alone: the site's Add credits page with this amount chosen\. The account owner opens it, signs in, selects Continue to checkout and pays on the provider's page\. The call opened no checkout\.<br><br>Type: string<br>Format: uri |
| /<wbr>properties/<wbr>detail | Who opens the link and pays, who sells the prepaid credit, and when prepaid credit is granted\. This answer grants no prepaid credit\.<br><br>Type: string |

## Complete payload contract

```json
{
  "request": {
    "type": "object",
    "required": [
      "amount"
    ],
    "properties": {
      "amount": {
        "type": "integer",
        "enum": [
          25,
          50,
          100,
          250
        ],
        "description": "The prepaid credit to buy, in whole US dollars. Use one of this member's enumerated amounts."
      }
    },
    "additionalProperties": false
  },
  "response": {
    "type": "object",
    "required": [
      "contract_version",
      "amount",
      "currency",
      "detail"
    ],
    "anyOf": [
      {
        "required": [
          "purchase",
          "state",
          "checkout_url"
        ]
      },
      {
        "required": [
          "add_credits_url"
        ]
      }
    ],
    "properties": {
      "contract_version": {
        "const": 1
      },
      "reference": {
        "type": "string",
        "pattern": "^[0-9a-f]{10}$",
        "description": "The short reference the platform recorded your call under: ten lowercase hexadecimal characters, the value in the call’s record row. Quote it when you report the call."
      },
      "purchase": {
        "type": "string",
        "pattern": "^pur_[0-9a-f]{32}$",
        "description": "The purchase id generated by the platform. It identifies no account. Absent over MCP, where the call starts no purchase."
      },
      "amount": {
        "type": "integer",
        "description": "The prepaid credit requested, in whole US dollars, before any tax."
      },
      "currency": {
        "const": "usd",
        "description": "The currency of the prepaid credit requested, US dollars."
      },
      "state": {
        "const": "started",
        "description": "Checkout was opened. This state does not say payment was made or prepaid credit was granted. Absent over MCP."
      },
      "checkout_url": {
        "type": "string",
        "format": "uri",
        "description": "The payment provider's checkout address, returned outside MCP. The site's Add credits page sends the account owner there to pay. Absent over MCP."
      },
      "add_credits_url": {
        "type": "string",
        "format": "uri",
        "description": "Over MCP alone: the site's Add credits page with this amount chosen. The account owner opens it, signs in, selects Continue to checkout and pays on the provider's page. The call opened no checkout."
      },
      "detail": {
        "type": "string",
        "description": "Who opens the link and pays, who sells the prepaid credit, and when prepaid credit is granted. This answer grants no prepaid credit."
      }
    }
  }
}
```

## Shared contracts

- [Refusals](/cloud/reference/refusals/): every refusal, by surface, with its cause and its remedy
- [schemas/wire\_error\.schema\.json](/cloud/reference/sources/schemas/wire-error-schema/)
- [schemas/wire\_errors\.json](/cloud/reference/sources/schemas/wire-errors/)
- [schemas/action\_payloads\.json](/cloud/reference/sources/schemas/action-payloads/) (includes shared shapes)
- [management\_api\_contract\.md](/cloud/reference/sources/management-api-contract/)
