> ## Documentation Index
> Fetch the complete documentation index at: https://docs.droyd.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Create a top-up

> Purchase prepaid evaluation funds.

Purchase `$5.00`–`$500.00` of prepaid funds by sending a decimal USD string:

```json theme={null}
{
  "amount_usd": "25.00"
}
```

The response is `200` if payment has already completed or `202` while it is
pending. Funds are not spendable until the status is `paid`.

Auth: Droyd API key or signed-in user bearer token. Alias:
`POST /api/v1/billing/top-ups`. Requires an `Idempotency-Key` header of 8–120
URL-safe characters. `amount_usd` must be a decimal string from `5.00` through
`500.00` with at most two fractional digits. Reuse the same key only for the
same amount. The caller must already have a saved payment method.

Statuses are `pending`, `payment_pending`, `action_required`, `paid`, `failed`,
or `cancelled`. If `action_required`, use the transient client secret with
Stripe's SDK and then poll the returned URL.


## OpenAPI

````yaml api-key.openapi.json POST /v1/billing/top-ups
openapi: 3.1.0
info:
  title: Droyd API-key Automation API
  version: 1.0.0
  description: >-
    The production API contract for Droyd API-key automations. It contains only
    operations that accept a Droyd API key. `/v1` is canonical; `/api/v1` is a
    compatibility alias.
servers: []
security:
  - droydApiKeyBearer: []
  - droydApiKeyHeader: []
tags:
  - name: Identity
    description: Account-scoped automation identity and onboarding state.
  - name: Workflows
    description: Caller-owned workflows and research nodes.
  - name: Competitions
    description: Competition readiness, submissions, and race entries.
  - name: Experiments
    description: Experiments, artifacts, agent versions, and evaluations.
  - name: Usage
    description: Caller-owned evaluation usage.
  - name: Billing
    description: Caller-owned prepaid credit balances and funding.
paths:
  /v1/billing/top-ups:
    post:
      tags:
        - Billing
      summary: Purchase prepaid funds for the caller.
      operationId: createBillingTopUp
      parameters:
        - $ref: '#/components/parameters/IdempotencyKey'
      requestBody:
        $ref: '#/components/requestBodies/BillingTopUp'
      responses:
        '200':
          $ref: '#/components/responses/Success'
        '202':
          $ref: '#/components/responses/Success'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '409':
          $ref: '#/components/responses/Conflict'
        '503':
          $ref: '#/components/responses/ServerError'
components:
  parameters:
    IdempotencyKey:
      name: Idempotency-Key
      in: header
      required: true
      schema:
        type: string
        minLength: 8
        maxLength: 120
        pattern: ^[A-Za-z0-9][A-Za-z0-9._:-]{7,119}$
  requestBodies:
    BillingTopUp:
      required: true
      content:
        application/json:
          schema:
            type: object
            required:
              - amount_usd
            additionalProperties: false
            properties:
              amount_usd:
                type: string
                pattern: ^(?:[5-9]|[1-9][0-9]|[1-4][0-9]{2}|500)(?:\.[0-9]{1,2})?$
  responses:
    Success:
      description: Successful response.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/SuccessEnvelope'
    BadRequest:
      description: Invalid request.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorEnvelope'
    Unauthorized:
      description: Missing or invalid API key.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorEnvelope'
    Forbidden:
      description: Account state or route policy prevents the request.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorEnvelope'
    Conflict:
      description: The resource state or idempotency key conflicts with the request.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorEnvelope'
    ServerError:
      description: >-
        The request could not be completed. Retry only when the operation's
        idempotency contract permits it.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorEnvelope'
  schemas:
    SuccessEnvelope:
      type: object
      required:
        - ok
      properties:
        ok:
          const: true
      additionalProperties: true
    ErrorEnvelope:
      type: object
      required:
        - ok
        - error
      properties:
        ok:
          const: false
        error:
          type: object
          required:
            - code
            - message
          properties:
            code:
              type: string
            message:
              type: string
  securitySchemes:
    droydApiKeyBearer:
      type: http
      scheme: bearer
      bearerFormat: Droyd API key
      description: A Droyd API key in the Authorization Bearer slot.
    droydApiKeyHeader:
      type: apiKey
      in: header
      name: x-droyd-api-key
      description: A Droyd API key when Authorization is absent.

````