← All API sections

API Keys

Create and manage API keys and their scopes

3 endpoints
Menu

Endpoints

MethodPathDescription
GET/v1/api-keysList all API keys for the account
POST/v1/api-keysCreate a new API key with optional scopes
DELETE/v1/api-keys/{id}Revoke an API key

GET /v1/api-keys

List all API keys for the account

Responses

StatusDescription
200List of API keys
401Unauthorized

Example

curl -X GET https://api.euromail.dev/v1/api-keys \
  -H "Authorization: Bearer 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

Create a new API key with optional scopes

Request Body

FieldTypeRequiredDescription
namestringYes
scopesstring[]No

Responses

StatusDescription
201API key created (raw key returned only at creation)
401Unauthorized
403The caller may not administer the account, or asked for scopes beyond its own
422Invalid scope

Example

curl -X POST https://api.euromail.dev/v1/api-keys \
  -H "Authorization: Bearer em_live_..." \
  -H "Content-Type: application/json" \
  -d '{
  "name": "..."
}'
import { EuroMail } from "@euromail/sdk";

const euromail = new EuroMail({ apiKey: "em_live_..." });

const result = await euromail.createApiKey({
  name: "..."
});
from euromail import EuroMail

client = EuroMail(api_key="em_live_...")

result = client.create_api_key(
    name="...",
)
use euromail::{EuroMail, CreateApiKeyParams};

let client = EuroMail::new("em_live_...");

let result = client.create_api_key(&CreateApiKeyParams {
    name: "...".into(),
    ..Default::default()
}).await?;
client := euromail.NewClient("em_live_...")

result, err := client.CreateApiKey(ctx, euromail.CreateApiKeyParams{
    Name: "...",
})

DELETE /v1/api-keys/{id}

Revoke an API key

Parameters

NameInTypeRequiredDescription
idpathstringYesAPI Key ID

Responses

StatusDescription
204API key revoked
401Unauthorized
404API key not found

Example

curl -X DELETE https://api.euromail.dev/v1/api-keys/{id} \
  -H "Authorization: Bearer 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_...")