Card Vault

Use with OpenAI's API.

Give an agent you build on OpenAI's API the tools to take a card. The agent creates a link to our card form and sees a token, the card type and the last four digits, never the card number.

OpenAI's Responses API can connect a model to a remote tool server (the Model Context Protocol, MCP). You name the server and pass a credential in your request, and the model gets the server's tools for that request. Ours gives it four: one creates the card form link, one reads whether the card was entered, one reads a stored card in masked form, and one deletes a stored CVV. None of them takes a card number, and none returns one.

This page is for agents you build with OpenAI's API. There is nothing to install: it works with a client ID you already have, on any plan, as long as it has no IP allowlist. This page does not cover the ChatGPT app.

What you need

  • A client ID and its secret for Card Vault. A capture-only client ID, on the Growth or Business plan, is the safer one to give an agent: it is limited to card capture, reading masked cards and deleting a CVV.
  • No IP allowlist on that client ID. OpenAI calls our tool server from its own addresses, so a client ID that has an IP allowlist cannot be used this way: the tools are listed, but every call is refused.
  • An OpenAI API key and a model that supports remote MCP tools.

Connect

  1. Get an access token on your server. Exchange the client ID and secret for a token. It lasts an hour, so your server gets a new one when it runs out. The secret is typed at a silent prompt and handed to curl on its input, so it is not in your shell history or in the command's arguments.
    CLIENT_ID=your-client-id
    read -rs CLIENT_SECRET
    printf 'user = "%s:%s"\n' "$CLIENT_ID" "$CLIENT_SECRET" | curl -s -K - \
      -d "grant_type=client_credentials&scope=io.enigmavault/cardvault" \
      https://api-auth.enigmavault.io/oauth2/token
    { "access_token": "eyJ...", "expires_in": 3600, "token_type": "Bearer" }
    Put the access_token in VAULT_TOKEN for the next step.
  2. Add our tool server to your request. In the request's tools, add one of type mcp with our address and the token in authorization. OpenAI sends the token to our tool server with each call it makes for this request. Send it with every request: OpenAI's guide says it does not store it.
    curl https://api.openai.com/v1/responses \
      -H "Content-Type: application/json" \
      -H "Authorization: Bearer $OPENAI_API_KEY" \
      -d '{
        "model": "gpt-6.2-astra",
        "tools": [{
          "type": "mcp",
          "server_label": "enigma_vault",
          "server_url": "https://mcp.enigmavault.io/mcp",
          "authorization": "'"$VAULT_TOKEN"'",
          "allowed_tools": ["create_card_capture_link", "get_card_capture_status"],
          "require_approval": "never"
        }],
        "input": "Create a card capture link for order 4471 that stays open for 15 minutes."
      }'
    As written, the model may use the two tools that take a card, without asking your code first. To let it also read a stored card or delete a CVV, add get_card or delete_cvv to allowed_tools, as under The tool's settings. For a client ID in the EU region (EU data residency), the address is https://mcp-eu.enigmavault.io/mcp.
  3. Read the answer. The response's output holds what happened, in order: an mcp_list_tools item with the tools the model was given, an mcp_call item for each tool the model used, with its arguments, its output and an error that is empty when the call worked, and the model's message. The first tool's output holds the link (url) and a session_id. Send the link to your customer with the text, chat or email service you already use.
  4. Check the outcome. In a later request, with the same tool in tools, ask whether the card was entered and give the session ID: "Has the customer entered the card for session 52459530-...? Tell me the card type and the last four digits." The model calls get_card_capture_status with it. Or leave the model out of it and read the outcome on your own server, from the webhook or the status call.

The tool's settings

SettingWhat to give
server_urlhttps://mcp.enigmavault.io/mcp, or https://mcp-eu.enigmavault.io/mcp for a client ID in the EU region
authorizationThe access token from step 1, by itself. A token that has run out is refused: get a new one and send the request again
require_approval"never" lets the model call the tools without asking your code first. Left out, OpenAI's guide says the response stops at an mcp_approval_request for each call, and your code approves it in a following request
allowed_toolsThe tools this agent may use. An agent that only takes cards needs create_card_capture_link and get_card_capture_status. Left out, the model gets all four

What each tool takes and returns is under Our tool server. OpenAI's Agents SDK documents the same settings for its hosted MCP tool.

What the agent can and cannot do

With the four tools, the agent canThe agent cannot
Create a link to the hosted card formReceive a card number or a security code from any tool
See whether the customer has entered the cardCharge a card or move money: there is no tool for it
Read a card masked, by its token: card type, last four digits, expirationDo more than the client ID behind the token is allowed to
Delete the stored security code of a card whose token it hasReach a card through a format-preserving token: the tools do not return or accept one

Charging the card is not something the agent does. A server of yours charges the card's token through your payment gateway: see Charge the token.

Things to know

  • Keep the secret on your server. Your server exchanges the client ID and secret for the token. Only the token, which lasts an hour, goes to OpenAI. That token can do whatever its client ID can for the hour it lasts, which is the reason to use a capture-only client ID here.
  • What OpenAI sees. OpenAI's servers make the tool calls, so the model and OpenAI receive what the tools return: the link, the session ID, your reference, and once a card is stored its token, card type, last four digits and expiration. They never receive a card number or a security code, because no tool returns one.
  • The token reaches the agent. The status tool returns the card's token so the agent can hand it to your systems. A token is not card data, but there is no reason for the agent to say it or write it into the conversation. If you would sooner keep it away from the agent, take it from the webhook or the status call on your own server.
  • Each tool call is a request on your plan, status checks included.
  • Use the tool server of your client ID's region. The EU tool server calls the EU API, and the links it returns are on api-eu.enigmavault.io.
  • Tell your agent the rule yourself. Put it in the agent's own instructions: never ask for, accept or repeat a card number, an expiration date or a security code. See Keep card numbers out of the conversation.
  • Card details typed into the conversation are not stopped by us. The tools never ask for them and refuse an argument recognized as card data, but only the form keeps a card number out of a conversation. Send the link.

See also the guide to card capture for AI agents, connecting from Claude and pricing. Questions: support@enigmavault.io.