Skip to main content
Connect a user to Agentcard without sending them to a hosted page. You build the screens; Agentcard sends the one-time code and hands you back the user’s access token. Everything happens through your own interface — your users never see an Agentcard-hosted page. (If your app opens a “Connect your account” sign-in at mcp.agentcard.sh, you’ve wired the MCP server’s OAuth flow instead of this API: trigger the code with connect/start and hand the resulting token straight to the MCP server.)

Instructions for your agent

Paste this into your coding agent to implement the connect flow.
Instructions for your agent

How it works

  1. Your backend asks Agentcard to send the user a code (by email or phone).
  2. The user types the code into your app.
  3. Your backend submits the code and receives the user’s access token.
  4. Your backend records the user’s consent (your terms must include the payment-processor privacy disclosure — it enables the wallet-funding rail for the connection).
Every call is made from your backend with your platform access token in the Authorization header. Each step below links to its page in the API reference, where you’ll find every parameter, every response field, and a live playground to try the call with your own credentials.

The flow

1

Authenticate your platform

Exchange your client_id + client_secret for a platform access token and send it as Authorization: Bearer <token> on every call. Tokens live one hour — cache and reuse.Create an access token
2

Send the code

Ask Agentcard to send a one-time code to the user, by email or phone (exactly one). Store the returned id — it’s the connect_id for the next step.Send a code
3

Verify the code

Submit the code the user typed into your app. On success you get the user’s connection token — it acts on behalf of that user (send it to the MCP server to create cards and shop as them) — plus user.id, which every later call names the user by. Store all three: user.id, access_token, refresh_token.Verify the code
4

Record consent

Record that the user authorized your platform to act on their behalf. Idempotent per user — safe to retry. Don’t skip it: the consent also covers the card issuer’s terms, so identity verification later goes straight to the face scan instead of pausing the user on an extra terms page.Record consent
5

Keep the connection alive

Connection tokens expire after one hour. Exchange the refresh token for a new pair before then, and replace both stored tokens every time.Refresh the connection
In sandbox the code is always 111111, so you can run this whole flow — including from the reference playground — without a real inbox or phone.

Customize the code email

The email your users receive is yours to design. Set it up in your Agentcard dashboard, and every code you send uses it.