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

# Create an allowance

> This is endpoint returns an [unsigned transaction](/api-reference/architecture/transaction-lifecycle) that pre-approves a `spender_address` account to transfer a specified amount of tokens from the `holder_address` account. Once you sign this transaction, using your private key held in your local environment variables, you can broadcast it using the [Execute Transaction](/api-reference/endpoint/transactions/post-transactionsexecute) endpoint; or if you prefer to wait for confirmation using the [Execute Transaction and Wait](/api-reference/endpoint/transactions/post-transactionsexecuteandwait) endpoint.

<ResponseExample>
  ```json 200 theme={null}
  {
    "success": true,
    "unsignedTransaction": {
      "to": "0x014b680bed2433b1861239cf812dbe660fe339f2",
      "data": "0x609512c90000000000000000000000009574e9ba92cb0966c9d2ff1a9ab9e11949b9b873000000000000000000000000f39fd6e51aad88f6f4ce6ab8827279cfffb922660000000000000000000000000000000000000000000000000de0b6b3a7640000647261676f6e5f736c6179656400000000000000000000000000000000000000414354494f4e000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000000000",
      "maxPriorityFeePerGas": "1020840008",
      "maxFeePerGas": "1035102698",
      "gas": "476358",
      "gasLimit": "476358",
      "nonce": 36,
      "chainId": 31337,
      "type": 2
    }
  }
  ```

  ```json 400 theme={null}

  {
    "success": false,
    "error": {
      "code": "validation_error",
      "message": "Some parameters are invalid",
      "issues": [
        {
          "code": "too_small",
          "message": "Number must be greater than 0",
          "parameter": "amount",
          "path": "amount"
        }
      ]
    }
  }
  ```

  ```JSON 404 theme={null}
  {
    "success": false,
    "error": {
      "code": "token_not_found",
      "message": "Credit token not found"
    }
  }
  ```

  ```JSON 500 theme={null}
  {
    "success": false,
    "error": {
      "code": "transaction_error",
      "message": "There was an error in the blockchain transaction",
      "transaction_error": {
        "reason": "Error: ERC20Base__ApproveToZeroAddress() ",
        "message": "The contract function \"approve\" reverted.",
        "detailsMessage": "Error: ERC20Base__ApproveToZeroAddress()   Contract Call:   address:   0x014b680bed2433b1861239cf812dbe660fe339f2\n  function:  approve(address spender, uint256 amount)\n  args:             (0x0000000000000000000000000000000000000000, 1000000000000000000)\n  sender:    0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266",
        "contract_address": "0x014b680bed2433b1861239cf812dbe660fe339f2",
        "chain_id": 31337,
        "function_name": "approve",
        "data": {
          "abiItem": {
            "inputs": [],
            "name": "ERC20Base__ApproveToZeroAddress",
            "type": "error"
          },
          "errorName": "ERC20Base__ApproveToZeroAddress"
        }
      }
    }
  }
  ```
</ResponseExample>


## OpenAPI

````yaml post /credit/approve
openapi: 3.0.0
info:
  version: 0.1.0
  title: Openformat API
servers:
  - url: https://api.openformat.tech/v1
    description: Live server
security:
  - ApiKeyAuth: []
paths:
  /credit/approve:
    post:
      tags:
        - credit
        - approve
        - show
      description: >-
        Approve a spender account to transfer credits that belong to a holder
        account
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                chain:
                  type: string
                  minLength: 1
                  maxLength: 255
                  description: Blockchain network to use
                  example: arbitrum-sepolia
                token_id:
                  type: string
                  description: Ethereum address of the credit token
                  example: '0xd1f09c70f6f2838a3ab6209c1465af68594667ec'
                holder_address:
                  type: string
                  description: Ethereum address of the token holder account
                  example: '0xcf7ed3acca5a467e9e704c703e8d87f634fb0fc9'
                spender_address:
                  type: string
                  description: Ethereum address of the spender account
                  example: '0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266'
                amount:
                  type: number
                  minimum: 0
                  exclusiveMinimum: true
                  description: Amount of credit tokens to approve
                  example: 123
              required:
                - chain
                - token_id
                - holder_address
                - spender_address
                - amount
      responses:
        '200':
          description: Transfer transaction to sign
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    enum:
                      - true
                    description: Success response
                    example: true
                  unsignedTransaction:
                    nullable: true
                    description: Unsigned transaction object for the user to sign
                required:
                  - success
        '400':
          description: Bad request
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: object
                    properties:
                      issues:
                        type: array
                        items:
                          type: object
                          properties:
                            code:
                              type: string
                              description: Error code for the field
                              example: invalid_type
                            path:
                              type: array
                              items:
                                type: string
                              description: Field with error
                              example:
                                - some_field
                            message:
                              type: string
                              description: Error message
                              example: Required
                          required:
                            - code
                            - path
                            - message
                        description: Error object with all validation issues
                    required:
                      - issues
                required:
                  - error
        '404':
          description: Credit token not found
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: string
                    enum:
                      - failed
                    description: Failed reponse status
                    example: failed
                  error:
                    type: string
                    description: Error message
                    example: No Token found
                required:
                  - status
                  - error
components:
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: X-API-KEY

````