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

# Create Token

> Create a Token for future transactions



## OpenAPI

````yaml /openapi.yml post /api/v2/tokens
openapi: 3.0.3
info:
  title: Gateway API
  version: v2
  contact:
    name: Support
    email: support@paybyrd.com
  license:
    name: Copyright © Paybyrd
  termsOfService: https://paybyrd.com/en/privacy
servers:
  - url: https://gateway.paybyrd.com
    description: Production
security:
  - authByApiKey: []
paths:
  /api/v2/tokens:
    post:
      tags:
        - Tokenization
      summary: Create Token
      description: Create a Token for future transactions
      operationId: api-tokenize-create
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CardTokenizeRequest'
      responses:
        '201':
          description: '201'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CardTokenizeResponse'
      deprecated: false
components:
  schemas:
    CardTokenizeRequest:
      type: object
      required:
        - Type
        - Card
        - CustomReference
        - Alias
        - RedirectUrl
      properties:
        Type:
          type: string
          description: Identity the type of the token (currently only "card")
          example: Card
        CustomReference:
          type: string
          description: >-
            Identify the token by an aggregation reference of your business
            (CustomerId, WalletId, StoreId ...)
          example: Wallet123
        Alias:
          type: string
          description: Alias for the new token (usually provided by the customer)
          example: MyShoppingCard
        RedirectUrl:
          type: string
          description: >-
            The url that redirect the user at the end of 3ds validation (in
            fail, succes and reject cases)
          example: http://client.co/3ds/validation?token=123456
        TransactionMode:
          type: string
          description: >-
            "transactionMode" is used for tokenization and tokenized payments.
            The value "initialUnescheduled" tokenizes details for future
            one-time, unscheduled payments. The value "initialRecurring'
            tokenizes details for the first in a series of scheduled payments.
            The value "cardHolderInitiatedUnescheduled" is for subsequent
            unscheduled payment initiated by the cardholder. The value
            "merchantInitiatedUnescheduled" is for unscheduled payment initiated
            by the merchant. The value "merchantInitiatedRecurring" is for
            subsequent scheduled payment initiated by the merchant.
          enum:
            - initialUnescheduled
            - initialRecurring
            - cardHolderInitiatedUnescheduled
            - merchantInitiatedUnescheduled
            - merchantInitiatedRecurring
        Card:
          $ref: '#/components/schemas/Card'
    CardTokenizeResponse:
      type: object
      properties:
        card:
          $ref: '#/components/schemas/CardResponse'
        tokenId:
          type: string
          description: The id of generated token
          example: 5d3491c3-8978-4ff5-8d74-31b0b0499b01
        customReference:
          type: string
          description: The customReference sent in the CardTokenizeRequest
          example: Wallet123
        alias:
          type: string
          description: The Alias sent in the CardTokenizeRequest
          example: PersonalCard
        action:
          $ref: '#/components/schemas/Action'
    Card:
      type: object
      required:
        - number
        - expiration
        - cvv
        - holder
      properties:
        number:
          type: string
          description: The card number
          example: '5149682323738886'
        expiration:
          type: string
          description: The card expiration date with pattern "MM/YY"
          example: 03/29
        cvv:
          type: string
          description: The Card Verification Value
          example: '929'
        holder:
          type: string
          description: The card holder name
          example: Peter Parker
        aav:
          type: string
          description: The authentication value returned by the 3DS authentication
        dsTransactionId:
          type: string
          description: >-
            The transaction id returned by the Directory Server executed on 3DS
            authentication
        eci:
          type: string
          description: The card ECI code returned by the 3DS authentication
        xid:
          type: string
          description: The card transaction identifier returned by the 3DS authentication
        verificationMethod:
          type: string
          description: >-
            The card verification method indicates if the 3DS was previously
            performed.  When this value is not provided, Paybyrd will respond
            with the action URL to initiate the 3D Secure flow. For that case, a
            second step will be required for the payment creation. For
            'ThreeDSecure' it is also necessary to provide the 3DS
            authentication data (aav, dsTransactionId, eci and threeDsVersion).
            When 'ThreeDSecureAttempt' is provided, a proof of attempt must also
            be sent. In case you want Paybyrd to handle all the 3DS flow, you
            must leave this field empty. For this scenario, we will respond with
            an Action Url that must be triggered on the client side. This will
            trigger the 3DS flow automatically.
          enum:
            - ThreeDSecure
            - ThreeDSecureAttempt
            - None
    CardResponse:
      type: object
      properties:
        number:
          type: string
          description: The masked card number
          example: 514968******8886
        expiration:
          type: string
          description: The card expiration date with pattern "MM/YY"
          example: 03/29
        cvv:
          type: string
          description: The masked card verification value
          example: '***'
        holder:
          type: string
          description: The card holder name
          example: Peter Parker
        aav:
          type: string
          description: The authentication value returned by the 3DS authentication
        dsTransactionId:
          type: string
          description: >-
            The transaction id returned by the Directory Server executed on 3DS
            authentication
        eci:
          type: string
          description: The card ECI code returned by the 3DS authentication
        xid:
          type: string
          description: The card transaction identifier returned by the 3DS authentication
        verificationMethod:
          type: string
          description: >-
            The card verification method indicates if the 3DS was previously
            performed.             
          enum:
            - ThreeDSecure
            - ThreeDSecureAttempt
            - None
        scheme:
          type: string
          description: >-
            The card scheme. This field will not be always available in the
            response.
          enum:
            - Undefined
            - Visa
            - Master
            - Amex
            - JCB
            - Diners
            - Discover
        usage:
          type: string
          description: >-
            The card usage. This field will not be always available in the
            response.
          enum:
            - Undefined
            - Credit
            - Debit
        countryCode:
          type: string
          description: >-
            Three letter country code (ISO 3166). This field will not be always
            available in the response.
          example: PRT
    Action:
      type: object
      required:
        - type
        - url
      properties:
        type:
          type: string
          description: The type of the action to be taken by the merchant
          enum:
            - redirect
        url:
          type: string
          description: The URL to be used in order to finalize the payment
          example: >-
            https://gateway.paybyrd.com/v1/ThreeDSecure/InitiatePayment?transactionId=0411c4cf-3d6c-4315-ac5e-98fb1d72f11f
  securitySchemes:
    authByApiKey:
      type: apiKey
      in: header
      name: x-api-key

````