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

# Tokenize a PAN



## OpenAPI

````yaml POST /toucan/tokens/tokenize
openapi: 3.0.0
info:
  title: Toucan API
  version: 1.0.0
servers:
  - url: https://services.sandbox.pagosapi.com
  - url: https://services.prod.pagosapi.com
security:
  - bearerAuth: []
paths:
  /toucan/tokens/tokenize:
    post:
      tags:
        - Toucan Tokenization
      summary: Tokenize a PAN
      operationId: Tokenize
      parameters:
        - name: x-merchant-id
          in: header
          required: true
          description: Merchant identifier for requests.
          schema:
            type: string
            nullable: false
      requestBody:
        x-name: TokenizeRequest
        description: ''
        content:
          application/json:
            schema:
              $ref: >-
                #/components/schemas/ToucanTokenAPIApplicationContractsRequestsTokenizeRequest
        required: true
        x-position: 1
      responses:
        '201':
          description: card was tokenized
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/ToucanTokenAPIApplicationContractsResponsesTokenizeResponse
        '400':
          description: tokenization errors
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/ToucanTokenAPIApplicationContractsTraceableErrorResponse
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/ToucanTokenAPIApplicationContractsTraceableErrorResponse
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/ToucanTokenAPIApplicationContractsTraceableErrorResponse
        '500':
          description: Server Error
          content:
            application/problem+json:
              schema:
                $ref: >-
                  #/components/schemas/ToucanTokenAPIApplicationContractsTraceableErrorResponse
components:
  schemas:
    ToucanTokenAPIApplicationContractsRequestsTokenizeRequest:
      type: object
      additionalProperties: false
      required:
        - accountNumber
        - expirationDate
      properties:
        accountNumber:
          type: string
          default: '1234123412341234'
          maxLength: 16
          minLength: 13
          pattern: ^[234569]
          nullable: false
        expirationDate:
          $ref: >-
            #/components/schemas/ToucanTokenAPIApplicationContractsRequestsExpirationDate
          minLength: 1
          nullable: false
        cvv2:
          type: string
          maxLength: 4
          minLength: 3
        accountHolder:
          $ref: >-
            #/components/schemas/ToucanTokenAPIApplicationContractsRequestsAccountHolder
        metadata:
          type: string
          maxLength: 50
          minLength: 0
    ToucanTokenAPIApplicationContractsResponsesTokenizeResponse:
      type: object
      additionalProperties: false
      properties:
        cardNetworkName:
          type: string
        token:
          type: string
        expirationDate:
          $ref: >-
            #/components/schemas/ToucanTokenAPIApplicationContractsRequestsExpirationDate
        tokenRefId:
          type: string
        tokenUniqueReference:
          type: string
          deprecated: true
          nullable: true
        panLast4:
          type: string
        metadata:
          type: string
        par:
          type: string
    ToucanTokenAPIApplicationContractsTraceableErrorResponse:
      type: object
      additionalProperties: false
      properties:
        code:
          type: integer
          format: int32
        requestId:
          type: string
        errorDetails:
          $ref: '#/components/schemas/ToucanTokenAPIApplicationContractsErrorDetails'
    ToucanTokenAPIApplicationContractsRequestsExpirationDate:
      type: object
      additionalProperties: false
      properties:
        year:
          type: string
          description: YYYY
          pattern: ^\d{4}$
        month:
          type: string
          description: MM
          pattern: ^\d\d$
    ToucanTokenAPIApplicationContractsRequestsAccountHolder:
      type: object
      additionalProperties: false
      properties:
        name:
          type: string
          maxLength: 64
          minLength: 0
        address:
          $ref: >-
            #/components/schemas/ToucanTokenAPIApplicationContractsRequestsAddress
    ToucanTokenAPIApplicationContractsErrorDetails:
      type: object
      additionalProperties: false
      properties:
        reason:
          type: string
        message:
          type: string
        details:
          type: array
          items:
            $ref: '#/components/schemas/ToucanTokenAPIApplicationContractsErrorDetail'
    ToucanTokenAPIApplicationContractsRequestsAddress:
      type: object
      additionalProperties: false
      properties:
        line1:
          type: string
          maxLength: 64
          minLength: 0
        line2:
          type: string
          maxLength: 64
          minLength: 0
        line3:
          type: string
          maxLength: 64
          minLength: 0
        city:
          type: string
          maxLength: 32
          minLength: 0
        state:
          type: string
          maxLength: 12
          minLength: 0
        country:
          type: string
          minLength: 3
          maxLength: 3
        postalCode:
          type: string
          maxLength: 10
          minLength: 0
    ToucanTokenAPIApplicationContractsErrorDetail:
      type: object
      additionalProperties: false
      properties:
        location:
          type: string
        message:
          type: string
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: 'Format is: `Bearer <api_key>`, where `<api_key>` is your Pagos API key'

````