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

# Send Verification Code

> Send a 6-digit verification code to an agent's Commune inbox. Step 1 of the sign-in flow.

<Note>
  Authenticate with HTTP Basic Auth: `Authorization: Basic base64(client_id:client_secret)`
</Note>

<RequestExample>
  ```typescript TypeScript theme={null}
  const credentials = Buffer.from(
    `${CLIENT_ID}:${CLIENT_SECRET}`
  ).toString('base64');

  const response = await fetch('https://api.commune.email/oauth/send-code', {
    method: 'POST',
    headers: {
      'Authorization': `Basic ${credentials}`,
      'Content-Type': 'application/json',
    },
    body: JSON.stringify({ email: 'acme-support@commune.email' }),
  });
  ```

  ```python Python theme={null}
  import base64, httpx

  credentials = base64.b64encode(
      f"{CLIENT_ID}:{CLIENT_SECRET}".encode()
  ).decode()

  resp = httpx.post(
      'https://api.commune.email/oauth/send-code',
      headers={
          'Authorization': f'Basic {credentials}',
          'Content-Type': 'application/json',
      },
      json={'email': 'acme-support@commune.email'},
  )
  ```

  ```bash cURL theme={null}
  curl -X POST https://api.commune.email/oauth/send-code \
    -H "Authorization: Basic $(echo -n 'comm_client_xxx:comm_secret_xxx' | base64)" \
    -H "Content-Type: application/json" \
    -d '{"email": "acme-support@commune.email"}'
  ```
</RequestExample>

<ResponseExample>
  ```json 200 theme={null}
  {
    "request_id": "otpreq_a1b2c3d4e5f6...",
    "expires_in": 600,
    "email_hint": "a***t@commune.email"
  }
  ```
</ResponseExample>

### Body

<ParamField body="email" type="string" required>
  The agent's Commune email address (e.g., `acme-support@commune.email`).
</ParamField>

### Response

<ResponseField name="request_id" type="string">
  Pass this to `POST /oauth/verify-code` along with the code.
</ResponseField>

<ResponseField name="expires_in" type="number">
  Seconds until the code expires (600 = 10 minutes).
</ResponseField>

<ResponseField name="email_hint" type="string">
  Masked email for display in your UI (e.g., `a***t@commune.email`).
</ResponseField>

### Errors

| Code | HTTP | Description |
| - | - | - |
| `agent_not_found` | 404 | No active Commune agent with this email. |
| `rate_limited` | 429 | Max 3 codes per email per 15 minutes. |
| `origin_not_allowed` | 403 | Request domain doesn't match your registered `websiteUrl`. |
| `email_send_failed` | 503 | Could not deliver the email. Retry. |


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.