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

# Purchase a credit package



## OpenAPI

````yaml /openapi.json post /v1/credits/purchase
openapi: 3.1.0
info:
  title: urltodata.ai
  description: >-
    API for extracting transcripts, metadata, and structured data from YouTube,
    TikTok, Instagram, X (Twitter), Facebook, and the web.
  version: 0.1.0
servers:
  - url: https://api.urltodata.ai
    description: Production API
security:
  - bearerAuth: []
paths:
  /v1/credits/purchase:
    post:
      summary: Purchase a credit package
      operationId: purchaseCredits
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - package_id
              properties:
                package_id:
                  type: string
                  description: Package ID from GET /v1/credits/packages
                redirect_origin:
                  type: string
                  format: uri
                  description: >-
                    Origin URL for Stripe checkout return redirect (must be an
                    allowed origin)
      responses:
        '200':
          description: Checkout session created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CreditPurchaseResponse'
        '400':
          $ref: '#/components/responses/InvalidRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
      security:
        - bearerAuth: []
components:
  schemas:
    CreditPurchaseResponse:
      type: object
      properties:
        checkout_url:
          type: string
    ApiError:
      type: object
      properties:
        error:
          type: string
        message:
          type: string
        details:
          type: string
        documentationUrl:
          type: string
  responses:
    InvalidRequest:
      description: Invalid request parameters
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ApiError'
    Unauthorized:
      description: Authentication required or invalid credentials
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ApiError'
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      x-default: your-api-key
      description: API key as Bearer token (e.g. Bearer mp_abc123_secret)

````