API Keys
Create and manage API keys and their scopes
3 endpoints
Endpoints
| Method | Path | Description |
| GET | /v1/api-keys | GET /v1/api-keys - List all API keys for the account |
| POST | /v1/api-keys | POST /v1/api-keys - Create a new API key with optional scopes |
| DELETE | /v1/api-keys/{id} | DELETE /v1/api-keys/:id - Revoke an API key |
GET /v1/api-keys
GET /v1/api-keys - List all API keys for the account
Responses
| Status | Description |
| 200 | List of API keys |
| 401 | Unauthorized |
Example
curl -X GET https://api.euromail.dev/v1/api-keys \
-H "X-EuroMail-Api-Key: em_live_..."
import { EuroMail } from "@euromail/sdk";
const euromail = new EuroMail({ apiKey: "em_live_..." });
const result = await euromail.listApiKeys();
from euromail import EuroMail
client = EuroMail(api_key="em_live_...")
result = client.list_api_keys()
use euromail::EuroMail;
let client = EuroMail::new("em_live_...");
let result = client.list_api_keys().await?;
client := euromail.NewClient("em_live_...")
result, err := client.ListApiKeys(ctx)
POST /v1/api-keys
POST /v1/api-keys - Create a new API key with optional scopes
Request Body
| Field | Type | Required | Description |
name | string | Yes | |
scopes | string[] | No | |
Responses
| Status | Description |
| 201 | API key created (raw key returned only at creation) |
| 401 | Unauthorized |
| 403 | The caller's team role does not allow account administration |
| 422 | Invalid scope |
Example
curl -X POST https://api.euromail.dev/v1/api-keys \
-H "X-EuroMail-Api-Key: em_live_..." \
-H "Content-Type: application/json" \
-d '{ "name": "example.com" }'
import { EuroMail } from "@euromail/sdk";
const euromail = new EuroMail({ apiKey: "em_live_..." });
const result = await euromail.createApiKey({
name: "example.com",
});
from euromail import EuroMail
client = EuroMail(api_key="em_live_...")
result = client.create_api_key(
name="example.com",
)
use euromail::EuroMail;
let client = EuroMail::new("em_live_...");
let result = client.create_api_key(&CreateApiKeyParams {
name: "example.com".into(),
..Default::default()
}).await?;
client := euromail.NewClient("em_live_...")
result, err := client.CreateApiKey(ctx, euromail.CreateApiKeyParams{
Name: "example.com",
})
DELETE /v1/api-keys/{id}
DELETE /v1/api-keys/:id - Revoke an API key
Parameters
| Name | In | Type | Required | Description |
id | path | string | Yes | API Key ID |
Responses
| Status | Description |
| 204 | API key revoked |
| 401 | Unauthorized |
| 404 | API key not found |
Example
curl -X DELETE https://api.euromail.dev/v1/api-keys/{id} \
-H "X-EuroMail-Api-Key: em_live_..."
import { EuroMail } from "@euromail/sdk";
const euromail = new EuroMail({ apiKey: "em_live_..." });
const result = await euromail.deleteApiKey("id_...");
from euromail import EuroMail
client = EuroMail(api_key="em_live_...")
result = client.delete_api_key("id_...")
use euromail::EuroMail;
let client = EuroMail::new("em_live_...");
let result = client.delete_api_key("id_...").await?;
client := euromail.NewClient("em_live_...")
result, err := client.DeleteApiKey(ctx, "id_...")