> ## Documentation Index
> Fetch the complete documentation index at: https://cantonfoundation-content-remove-editorial-todo-slow-commitm.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# POST /v0/wallet/buy-traffic-requests

> Create a request to buy traffic. Note that this only creates the request to do so. Refer to the status endpoint to check if the request succeeded.



## OpenAPI

````yaml /openapi/splice/validator/wallet-external.yaml post /v0/wallet/buy-traffic-requests
openapi: 3.0.0
info:
  title: Wallet API
  version: 0.0.1
servers:
  - url: https://example.com/api/validator
security: []
tags:
  - name: wallet
paths:
  /v0/wallet/buy-traffic-requests:
    post:
      tags:
        - wallet
      summary: POST /v0/wallet/buy-traffic-requests
      description: >-
        Create a request to buy traffic. Note that this only creates the request
        to do so. Refer to the status endpoint to check if the request
        succeeded.
      operationId: createBuyTrafficRequest
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateBuyTrafficRequest'
      responses:
        '200':
          description: Request to buy traffic got created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CreateBuyTrafficRequestResponse'
        '400':
          description: Request was invalid, adjust parameters
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '409':
          description: >-
            A request to buy traffic with the same tracking id has been created.
            Check the status endpoint for the current status.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '429':
          description: >-
            A request to buy traffic with the same tracking id is currently
            being processed. Check the status endpoint and resubmit if it
            returns 404.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '500':
          description: >-
            Internal server error that requires operator investigation. Retrying
            for a small number of times with exponential back-off MAY work.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
      security:
        - walletUserAuth: []
components:
  schemas:
    CreateBuyTrafficRequest:
      type: object
      required:
        - receiving_validator_party_id
        - domain_id
        - traffic_amount
        - tracking_id
        - expires_at
      properties:
        receiving_validator_party_id:
          description: >
            Traffic will be purchased for the validator hosting this party.

            If the party is hosted on multiple participants, the request will
            fail with 400 Bad Request.
          type: string
        domain_id:
          description: |
            The domain to purchase traffic for.
          type: string
        traffic_amount:
          description: |
            traffic to purchase in bytes.
          type: integer
          format: int64
        tracking_id:
          description: >
            Tracking id to support exactly once submission. Once submitted, all
            succeessive calls with the same tracking id

            will get rejected with a 409 or 429 status code unless the command
            fails and the traffic did not get purchased.

            Clients should create a fresh tracking id when they try to send a
            new request to buy traffic. If that command submission fails

            with a retryable error or the application crashed and got restarted,
            successive command submissions must reuse the same

            tracking id to ensure they don't purchase traffic multiple times.
          type: string
        expires_at:
          description: >
            Expiry time of the request to buy traffic as unix timestamp in
            microseconds. If the request does not

            succeed before this time, the wallet automation will reject and
            expire it.

            Note that this time is compared against the ledger effective time of
            the Daml transaction accepting or expiring an offer, and can skew
            from the wall clock

            time measured on the caller's machine. See
            https://docs.daml.com/concepts/time.html

            for how ledger effective time is bound to the record time of a
            transaction on a domain.
          type: integer
          format: int64
    CreateBuyTrafficRequestResponse:
      type: object
      required:
        - request_contract_id
      properties:
        request_contract_id:
          type: string
    ErrorResponse:
      type: object
      required:
        - error
      properties:
        error:
          type: string
  securitySchemes:
    walletUserAuth:
      description: >
        JWT token as described in
        [spliceAppBearerAuth]("../../../../common/src/main/openapi/common-external.yaml#/components/securitySchemes/spliceAppBearerAuth").

        The subject of the token must be ledger API user of the user whose
        wallet the endpoint affects.
      type: http
      scheme: bearer
      bearerFormat: JWT

````