---
title: "Create a credential for a tenant"
method: POST
path: "/tenants/{tenantId}/credentials"
tags: ["Credentials"]
---

# Create a credential for a tenant

`POST /tenants/{tenantId}/credentials`

Create a new SMTP or API credential for a tenant. The credential can be used
to send emails via Ark on behalf of the tenant.

**Important:** The credential key is only returned once at creation time.
Store it securely - you cannot retrieve it again.

**Credential Types:**
- `smtp` - For SMTP-based email sending. Returns both `key` and `smtpUsername`.
- `api` - For API-based email sending. Returns only `key`.

## Path parameters

- `tenantId` string, required

## Request body

- object
  - `name` string, required — Name for the credential. Can only contain letters, numbers, hyphens, and underscores. Max 50 characters.
  - `type` 'smtp' | 'api', required — Type of credential: - `smtp` - For SMTP-based email sending - `api` - For API-based email sending

## Response `201`

Credential created

- CredentialCreatedResponse
  - `success` true, required
  - `data` object, required
    - `id` integer, required — Unique identifier for the credential
    - `name` string, required — Name of the credential
    - `type` 'smtp' | 'api', required — Type of credential: - `smtp` - For SMTP-based email sending - `api` - For API-based email sending
    - `hold` boolean, required — Whether the credential is on hold (disabled). When `true`, the credential cannot be used to send emails.
    - `lastUsedAt` string, date-time, nullable, required — When the credential was last used to send an email
    - `createdAt` string, date-time, required — When the credential was created
    - `updatedAt` string, date-time, required — When the credential was last updated
    - `key` string, required — The credential key (secret). **Store this securely** - it will not be shown again unless you use the reveal parameter.
    - `smtpUsername` string — SMTP username for authentication. Only included for SMTP credentials. Format: `{tenantId}/{key}`
  - `meta` ApiMeta, required
    - `requestId` string, required — Unique request identifier for debugging and support

## Other responses

- `400` — Invalid request parameters
- `401` — Invalid or missing API key
- `403` — Missing required scope
- `404` — Tenant not found
- `429` — Rate limit exceeded
- `500` — Internal server error

---

[API](https://skmtc.net/arkhq-io/apis/ark-email-api.md) · [All operations](https://skmtc.net/arkhq-io/apis/ark-email-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/arkhq-io/ark-email-api/revisions/98a90852ffca/schema)
