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

# Create API key

> Generate a new programmatic API key for your workspace.

Create an API token (`mf_live_...`) to authorize backend services and SDKs.

> **Security Note**: The full secret plaintext token is returned only upon creation. Store it securely.

### Body Parameters

<ParamField body="name" type="string" required>
  Descriptive name for the key (e.g. `Production Backend`).
</ParamField>

<ParamField body="expires_at" type="string">
  Optional expiration timestamp in ISO 8601 format.
</ParamField>

### Response

<ResponseField name="data" type="object">
  <ResponseField name="id" type="string">API key ID.</ResponseField>
  <ResponseField name="name" type="string">Name.</ResponseField>
  <ResponseField name="secret_suffix" type="string">Last 4 characters of token.</ResponseField>
  <ResponseField name="token" type="string">The full API key secret.</ResponseField>
  <ResponseField name="created_at" type="string">Creation timestamp.</ResponseField>
</ResponseField>

<RequestExample>
  ```bash cURL theme={null}
  curl -X POST https://api.mailofly.com/api/v1/api-keys \
    -H "Authorization: Bearer mf_live_your_api_key" \
    -H "Content-Type: application/json" \
    -d '{
      "name": "Production App"
    }'
  ```
</RequestExample>

<ResponseExample>
  ```json 201 Created theme={null}
  {
    "data": {
      "id": "key_123456",
      "name": "Production App",
      "secret_suffix": "9aBc",
      "token": "mf_live_sample_token_secret_value_9aBc",
      "created_at": "2026-09-11T14:00:00Z"
    }
  }
  ```
</ResponseExample>


## Related topics

- [Create API key](/getting-started/api-keys.md)
- [Manage API Keys](/guides/api-keys/manage-api-keys.md)
- [Leaked API Keys](/guides/api-keys/leaked-api-keys.md)
- [AI onboarding](/getting-started/ai-onboarding.md)
- [API Key Security](/guides/api-keys/api-key-security.md)
