---
updatedAt: 2025-06-12T00:06:23.000Z
agentTools:
  projectIndex: https://developers.tap.company/llms.txt
---

# Create a Token (Encrypted Card)

This endpoint creates a token to securely store sensitive card information.

Tap's Encrypted Card Token endpoint provides a secure and simple way to store sensitive credit card information. The RSA algorithm is utilized for encryption and decryption, which is an asymmetric cryptographic algorithm.

To protect the customer's card information, it's encrypted using a public key and decrypted using a secret key. Please note that these tokens can only be used once, and they can be utilized in place of a source in the Charges, Authorize, or Card API.

Apple Pay can also use this endpoint by encrypting the "decrypted Apple payment data" to generate the token.

A test encryption key is available in the Test API Keys section for experimentation. However, please be aware that a PCI compliance certificate is required to access this endpoint. For more information, please contact our team. Alternatively, you can also create tokens using our JS Elements without the need to meet PCI compliance requirements.

This is the format to encrypt the card data

```text
{"number": “5123450000000008”, "exp_month": “01”, "exp_year": “2039”, "cvc": “100”, "name": "test user"}
```

# OpenAPI definition

```json
{
  "openapi": "3.1.0",
  "info": {
    "title": "tokens-encrypted-card.",
    "version": "1.0"
  },
  "servers": [
    {
      "url": "https://api.tap.company/v2/tokens"
    }
  ],
  "components": {
    "securitySchemes": {
      "sec0": {
        "type": "apiKey",
        "in": "header",
        "name": "Authorization",
        "x-bearer-format": "bearer",
        "x-default": "sk_test_XKokBfNWv6FIYuTMg5sLPjhJ"
      }
    }
  },
  "security": [
    {
      "sec0": []
    }
  ],
  "paths": {
    "/": {
      "post": {
        "summary": "Create a Token (Encrypted Card)",
        "description": "This endpoint creates a token to securely store sensitive card information.",
        "operationId": "create-a-token-encrypted-card",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "card": {
                    "type": "object",
                    "description": "Card object",
                    "properties": {
                      "crypted_data": {
                        "type": "string",
                        "description": "Encrypted card data",
                        "default": "Fl4rLIDSjSgfoePTSIj+gZmCWjnbLZur+5165ukpgGBa+e5XD7QcuLmTWycQI8DebZRsaFOZsXGzWkzoqQrVucJ6UE0ZeP7x6gWnBrUSx5GHdq434jzt+f2kGNmBcvzcUP0TTCWtolV608X2baS/ROQhoqqbbnQZ4q+iLNcuB2QmZmP20HSDUnIivPkkHVoJETCWvCV8D72rUHa6Zfhwzq314hcTcxpJHTqnCgH9JHmQ+CxPIPPE0hpgnQSAb4gc30KGhx4iCzK24gUWZD4hOHHRd4eeHZoAHi/aAw9tQrr+vwQywGFVBPlB17fRTrNeJn2f/956jCD3c3xUOvPWLQ=="
                      },
                      "address_city": {
                        "type": "string",
                        "description": "City",
                        "default": "City"
                      },
                      "address_country": {
                        "type": "string",
                        "description": "Country",
                        "default": "Country"
                      },
                      "address_line1": {
                        "type": "string",
                        "description": "Address line 1",
                        "default": "Address line 1"
                      },
                      "address_line2": {
                        "type": "string",
                        "description": "Address line 2",
                        "default": "Address line 2"
                      },
                      "address_state": {
                        "type": "string",
                        "description": "State",
                        "default": "State"
                      },
                      "address_zip": {
                        "type": "string",
                        "description": "000",
                        "default": "000"
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "200",
            "content": {
              "application/json": {
                "examples": {
                  "Result": {
                    "value": "{\n  \"id\": \"tok_xO6Z1525922tkF118QZ3f401\",\n  \"status\": \"ACTIVE\",\n  \"created\": 1744968135401,\n  \"object\": \"token\",\n  \"live_mode\": false,\n  \"type\": \"CARD\",\n  \"purpose\": \"CHARGE\",\n  \"used\": false,\n  \"card\": {\n    \"id\": \"card_KL8X1525922EOYp18DM3u576\",\n    \"object\": \"card\",\n    \"on_file\": false,\n    \"address\": {\n      \"country\": \"Country\",\n      \"state\": \"State\",\n      \"city\": \"City\",\n      \"zip_code\": \"000\",\n      \"line1\": \"Address line 1\",\n      \"line2\": \"Address line 2\",\n      \"primary\": false\n    },\n    \"funding\": \"DEBIT\",\n    \"fingerprint\": \"8874762d7d36ba89c258ad76316a5e05fc6c1f7be6905f85d2c705376a8c2b94\",\n    \"brand\": \"MASTERCARD\",\n    \"scheme\": \"MASTERCARD\",\n    \"category\": \"Visa Proprietary ATM\",\n    \"exp_month\": 1,\n    \"exp_year\": 39,\n    \"last_four\": \"0008\",\n    \"first_six\": \"512345\",\n    \"first_eight\": \"51234500\",\n    \"name\": \"test user\",\n    \"issuer\": {\n      \"country\": \"US\",\n      \"id\": \"bin_f33f4f7155bc4461b872350e8c797587\"\n    }\n  },\n  \"payment\": {\n    \"id\": \"card_KL8X1525922EOYp18DM3u576\",\n    \"on_file\": false,\n    \"card_data\": {\n      \"exp_month\": 1,\n      \"exp_year\": 39,\n      \"last_four\": \"0008\",\n      \"first_six\": \"512345\",\n      \"first_eight\": \"51234500\",\n      \"address\": {\n        \"country\": \"Country\",\n        \"state\": \"State\",\n        \"city\": \"City\",\n        \"zip_code\": \"000\",\n        \"line1\": \"Address line 1\",\n        \"line2\": \"Address line 2\",\n        \"primary\": false\n      }\n    },\n    \"fingerprint\": \"8874762d7d36ba89c258ad76316a5e05fc6c1f7be6905f85d2c705376a8c2b94\",\n    \"scheme\": \"MASTERCARD\",\n    \"category\": \"Visa Proprietary ATM\",\n    \"issuer\": {\n      \"country\": \"US\",\n      \"id\": \"bin_f33f4f7155bc4461b872350e8c797587\"\n    }\n  },\n  \"merchant\": {\n    \"id\": \"599424\"\n  }\n}"
                  }
                },
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "example": "tok_xO6Z1525922tkF118QZ3f401"
                    },
                    "status": {
                      "type": "string",
                      "example": "ACTIVE"
                    },
                    "created": {
                      "type": "integer",
                      "example": 1744968135401,
                      "default": 0
                    },
                    "object": {
                      "type": "string",
                      "example": "token"
                    },
                    "live_mode": {
                      "type": "boolean",
                      "example": false,
                      "default": true
                    },
                    "type": {
                      "type": "string",
                      "example": "CARD"
                    },
                    "purpose": {
                      "type": "string",
                      "example": "CHARGE"
                    },
                    "used": {
                      "type": "boolean",
                      "example": false,
                      "default": true
                    },
                    "card": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string",
                          "example": "card_KL8X1525922EOYp18DM3u576"
                        },
                        "object": {
                          "type": "string",
                          "example": "card"
                        },
                        "on_file": {
                          "type": "boolean",
                          "example": false,
                          "default": true
                        },
                        "address": {
                          "type": "object",
                          "properties": {
                            "country": {
                              "type": "string",
                              "example": "Country"
                            },
                            "state": {
                              "type": "string",
                              "example": "State"
                            },
                            "city": {
                              "type": "string",
                              "example": "City"
                            },
                            "zip_code": {
                              "type": "string",
                              "example": "000"
                            },
                            "line1": {
                              "type": "string",
                              "example": "Address line 1"
                            },
                            "line2": {
                              "type": "string",
                              "example": "Address line 2"
                            },
                            "primary": {
                              "type": "boolean",
                              "example": false,
                              "default": true
                            }
                          }
                        },
                        "funding": {
                          "type": "string",
                          "example": "DEBIT"
                        },
                        "fingerprint": {
                          "type": "string",
                          "example": "8874762d7d36ba89c258ad76316a5e05fc6c1f7be6905f85d2c705376a8c2b94"
                        },
                        "brand": {
                          "type": "string",
                          "example": "MASTERCARD"
                        },
                        "scheme": {
                          "type": "string",
                          "example": "MASTERCARD"
                        },
                        "category": {
                          "type": "string",
                          "example": "Visa Proprietary ATM"
                        },
                        "exp_month": {
                          "type": "integer",
                          "example": 1,
                          "default": 0
                        },
                        "exp_year": {
                          "type": "integer",
                          "example": 39,
                          "default": 0
                        },
                        "last_four": {
                          "type": "string",
                          "example": "0008"
                        },
                        "first_six": {
                          "type": "string",
                          "example": "512345"
                        },
                        "first_eight": {
                          "type": "string",
                          "example": "51234500"
                        },
                        "name": {
                          "type": "string",
                          "example": "test user"
                        },
                        "issuer": {
                          "type": "object",
                          "properties": {
                            "country": {
                              "type": "string",
                              "example": "US"
                            },
                            "id": {
                              "type": "string",
                              "example": "bin_f33f4f7155bc4461b872350e8c797587"
                            }
                          }
                        }
                      }
                    },
                    "payment": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string",
                          "example": "card_KL8X1525922EOYp18DM3u576"
                        },
                        "on_file": {
                          "type": "boolean",
                          "example": false,
                          "default": true
                        },
                        "card_data": {
                          "type": "object",
                          "properties": {
                            "exp_month": {
                              "type": "integer",
                              "example": 1,
                              "default": 0
                            },
                            "exp_year": {
                              "type": "integer",
                              "example": 39,
                              "default": 0
                            },
                            "last_four": {
                              "type": "string",
                              "example": "0008"
                            },
                            "first_six": {
                              "type": "string",
                              "example": "512345"
                            },
                            "first_eight": {
                              "type": "string",
                              "example": "51234500"
                            },
                            "address": {
                              "type": "object",
                              "properties": {
                                "country": {
                                  "type": "string",
                                  "example": "Country"
                                },
                                "state": {
                                  "type": "string",
                                  "example": "State"
                                },
                                "city": {
                                  "type": "string",
                                  "example": "City"
                                },
                                "zip_code": {
                                  "type": "string",
                                  "example": "000"
                                },
                                "line1": {
                                  "type": "string",
                                  "example": "Address line 1"
                                },
                                "line2": {
                                  "type": "string",
                                  "example": "Address line 2"
                                },
                                "primary": {
                                  "type": "boolean",
                                  "example": false,
                                  "default": true
                                }
                              }
                            }
                          }
                        },
                        "fingerprint": {
                          "type": "string",
                          "example": "8874762d7d36ba89c258ad76316a5e05fc6c1f7be6905f85d2c705376a8c2b94"
                        },
                        "scheme": {
                          "type": "string",
                          "example": "MASTERCARD"
                        },
                        "category": {
                          "type": "string",
                          "example": "Visa Proprietary ATM"
                        },
                        "issuer": {
                          "type": "object",
                          "properties": {
                            "country": {
                              "type": "string",
                              "example": "US"
                            },
                            "id": {
                              "type": "string",
                              "example": "bin_f33f4f7155bc4461b872350e8c797587"
                            }
                          }
                        }
                      }
                    },
                    "merchant": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string",
                          "example": "599424"
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "400",
            "content": {
              "application/json": {
                "examples": {
                  "Result": {
                    "value": "{\n  \"errors\": [\n    {\n      \"code\": \"1103\",\n      \"error\": \"Required_inputs_invalid\",\n      \"description\": \"Failed to decrypt RSA encryption, please check your encryption\"\n    }\n  ]\n}"
                  }
                },
                "schema": {
                  "type": "object",
                  "properties": {
                    "errors": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "code": {
                            "type": "string",
                            "example": "1103"
                          },
                          "error": {
                            "type": "string",
                            "example": "Required_inputs_invalid"
                          },
                          "description": {
                            "type": "string",
                            "example": "Failed to decrypt RSA encryption, please check your encryption"
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "deprecated": false
      }
    }
  },
  "x-readme": {
    "headers": [],
    "explorer-enabled": true,
    "proxy-enabled": true
  },
  "x-readme-fauxas": true
}
```