---
updatedAt: 2025-09-02T07:17:19.000Z
agentTools:
  projectIndex: https://jamaibase.readme.io/llms.txt
---

# Purchase credits for an organization.

Permissions: `organization.ADMIN`.

# OpenAPI definition

```json
{
  "openapi": "3.1.0",
  "info": {
    "title": "JamAI Base API",
    "license": {
      "name": "Apache 2.0",
      "url": "https://www.apache.org/licenses/LICENSE-2.0.html"
    },
    "version": "0.1.0",
    "x-logo": {
      "url": "https://www.jamaibase.com/favicon.svg"
    }
  },
  "servers": [
    {
      "url": "https://api.jamaibase.com"
    }
  ],
  "paths": {
    "/api/v2/organizations/credits": {
      "post": {
        "tags": [
          "Organizations (Internal API)"
        ],
        "summary": "Purchase credits for an organization.",
        "description": "Permissions: `organization.ADMIN`.",
        "operationId": "purchase_credits_api_v2_organizations_credits_post",
        "parameters": [
          {
            "name": "organization_id",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Organization ID.",
              "title": "Organization Id"
            },
            "description": "Organization ID."
          },
          {
            "name": "amount",
            "in": "query",
            "required": true,
            "schema": {
              "type": "integer",
              "exclusiveMinimum": 0,
              "description": "Purchase amount. A positive integer representing how much to charge in the smallest currency unit (e.g., 100 cents to charge $1.00 or 100 to charge ¥100, a zero-decimal currency). The minimum amount is $0.50 USD or equivalent.",
              "title": "Amount"
            },
            "description": "Purchase amount. A positive integer representing how much to charge in the smallest currency unit (e.g., 100 cents to charge $1.00 or 100 to charge ¥100, a zero-decimal currency). The minimum amount is $0.50 USD or equivalent."
          },
          {
            "name": "Authorization",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "description": "Service key.",
              "title": "Authorization"
            },
            "description": "Service key."
          },
          {
            "name": "X-USER-ID",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string",
              "description": "User ID.",
              "default": "",
              "title": "X-User-Id"
            },
            "description": "User ID."
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StripePaymentInfo"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "HTTPValidationError": {
        "properties": {
          "detail": {
            "items": {
              "$ref": "#/components/schemas/ValidationError"
            },
            "type": "array",
            "title": "Detail"
          }
        },
        "type": "object",
        "title": "HTTPValidationError"
      },
      "StripePaymentInfo": {
        "properties": {
          "status": {
            "type": "string",
            "title": "Status",
            "description": "Stripe invoice payment status."
          },
          "subscription_id": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^sub_.+"
              },
              {
                "type": "null"
              }
            ],
            "title": "Subscription Id",
            "description": "Stripe subscription ID."
          },
          "payment_intent_id": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^pi_.+"
              },
              {
                "type": "null"
              }
            ],
            "title": "Payment Intent Id",
            "description": "Stripe payment intent ID."
          },
          "client_secret": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Client Secret",
            "description": "Stripe client secret."
          },
          "amount_due": {
            "type": "integer",
            "title": "Amount Due",
            "description": "Amount due."
          },
          "amount_overpaid": {
            "type": "integer",
            "title": "Amount Overpaid",
            "description": "Amount overpaid."
          },
          "amount_paid": {
            "type": "integer",
            "title": "Amount Paid",
            "description": "Amount paid."
          },
          "amount_remaining": {
            "type": "integer",
            "title": "Amount Remaining",
            "description": "Amount remaining."
          }
        },
        "type": "object",
        "required": [
          "status",
          "subscription_id",
          "payment_intent_id",
          "client_secret",
          "amount_due",
          "amount_overpaid",
          "amount_paid",
          "amount_remaining"
        ],
        "title": "StripePaymentInfo"
      },
      "ValidationError": {
        "properties": {
          "loc": {
            "items": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "integer"
                }
              ]
            },
            "type": "array",
            "title": "Location"
          },
          "msg": {
            "type": "string",
            "title": "Message"
          },
          "type": {
            "type": "string",
            "title": "Error Type"
          }
        },
        "type": "object",
        "required": [
          "loc",
          "msg",
          "type"
        ],
        "title": "ValidationError"
      }
    },
    "securitySchemes": {
      "Authentication": {
        "type": "http",
        "scheme": "bearer"
      }
    }
  },
  "security": [
    {
      "Authentication": []
    }
  ]
}
```