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

# Send a code

> Sends a one-time code to the user by email or phone. Provide **exactly one** of `email` or `phone`. Codes are valid for 10 minutes.

If you've designed a connect email in your dashboard, we send that branded email; otherwise we send a default one.



## OpenAPI

````yaml openapi.json POST /api/v2/connect/start
openapi: 3.1.0
info:
  title: Agentcard API
  version: 2.0.0
  description: >-
    The Agentcard v2 API — connect your users and verify their identity from
    your own backend. Every call is authenticated with a platform access token
    minted from your `client_id` + `client_secret`.
servers:
  - url: https://api.agentcard.sh
    description: >-
      There is one base URL. Sandbox vs production is decided by the client
      credential you use, never by the host.
security:
  - platformToken: []
tags:
  - name: Authentication
    description: >-
      Exchange your client credentials for a platform access token, and
      introspect what a token acts as.
  - name: Connect
    description: >-
      Connect a user to your platform: send a one-time code, verify it, record
      consent, and keep the connection alive.
  - name: Identity verification
    description: >-
      Verify a connected user's identity: upload their ID, submit any extra
      fields we ask for, then show a short face scan.
  - name: Wallet funding
    description: >-
      Fund a connected user's wallet from your own UI — request a payment link,
      relay the phone verification code, and poll until the funds land.
  - name: Withdrawals
    description: >-
      Move money out of a connected user's wallet — to a saved bank account or a
      crypto address on Base. Transfers are processed manually by the Agentcard
      team, usually within 1-3 business days.
paths:
  /api/v2/connect/start:
    post:
      tags:
        - Connect
      summary: Send a code
      description: >-
        Sends a one-time code to the user by email or phone. Provide **exactly
        one** of `email` or `phone`. Codes are valid for 10 minutes.


        If you've designed a connect email in your dashboard, we send that
        branded email; otherwise we send a default one.
      operationId: connectStart
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                email:
                  type: string
                  format: email
                  description: The user's email address. Provide this or `phone`, not both.
                phone:
                  type: string
                  description: >-
                    The user's phone number in E.164 format (e.g.
                    `+15551234567`). Provide this or `email`, not both.
                external_user_id:
                  type: string
                  maxLength: 255
                  description: >-
                    Optional. Your own identifier for the user, stored on the
                    attempt for your reference.
            example:
              email: user@example.com
      responses:
        '201':
          description: The attempt. Pass its `id` back as `connect_id` when you verify.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ConnectAttempt'
              example:
                object: connect_attempt
                id: ca_9f8e7d6c
                channel: email
                expires_at: '2026-07-12T20:30:00.000Z'
        '400':
          description: >-
            `invalid_request` — missing or both of `email` and `phone`.
            `invalid_phone` — the number isn't valid or supported.
            `client_credentials_required` — the token wasn't minted from client
            credentials.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '502':
          description: '`auth_provider_error` — the code couldn''t be sent. Try again.'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '503':
          description: >-
            `auth_unavailable` — authentication is temporarily unavailable.
            Retry shortly.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
components:
  schemas:
    ConnectAttempt:
      type: object
      properties:
        object:
          type: string
          enum:
            - connect_attempt
        id:
          type: string
          description: The attempt id. Pass it back as `connect_id` when you verify.
        channel:
          type: string
          enum:
            - email
            - phone
          description: The channel the code was sent on.
        expires_at:
          type: string
          format: date-time
          description: When the attempt expires (ISO 8601). Codes are valid for 10 minutes.
    Error:
      type: object
      description: Every v2 error uses the same envelope.
      properties:
        error:
          type: object
          properties:
            code:
              type: string
              description: A stable, machine-readable string (snake_case). Branch on this.
            message:
              type: string
              description: A human-readable explanation, safe to log.
            docs:
              type: string
              description: A link back to the reference.
            field_errors:
              type: object
              additionalProperties:
                type: string
              description: Only on `invalid_fields` — names each field to fix.
            warnings:
              type: array
              items:
                type: string
              description: >-
                Only on document upload errors — actionable feedback safe to
                show the user.
  responses:
    Unauthorized:
      description: >-
        `unauthorized` — the platform access token is missing or expired.
        Exchange your client credentials for a fresh one.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  securitySchemes:
    platformToken:
      type: http
      scheme: bearer
      description: >-
        A platform access token. Get one on the **Create an access token**
        endpoint by exchanging your `client_id` + `client_secret`, then send it
        as `Authorization: Bearer <token>`. Tokens live one hour.

````