Skip to main content
POST
/
api-keys
Create an API key
curl --request POST \
  --url https://api.sendkit.dev/api-keys \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "name": "Production Key",
  "permission": "full",
  "domain_id": null,
  "expires_at": "2027-01-01 00:00:00"
}
'
import requests

url = "https://api.sendkit.dev/api-keys"

payload = {
"name": "Production Key",
"permission": "full",
"domain_id": None,
"expires_at": "2027-01-01 00:00:00"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: 'Production Key',
permission: 'full',
domain_id: null,
expires_at: '2027-01-01 00:00:00'
})
};

fetch('https://api.sendkit.dev/api-keys', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));
<?php

$curl = curl_init();

curl_setopt_array($curl, [
CURLOPT_URL => "https://api.sendkit.dev/api-keys",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'name' => 'Production Key',
'permission' => 'full',
'domain_id' => null,
'expires_at' => '2027-01-01 00:00:00'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
package main

import (
"fmt"
"strings"
"net/http"
"io"
)

func main() {

url := "https://api.sendkit.dev/api-keys"

payload := strings.NewReader("{\n \"name\": \"Production Key\",\n \"permission\": \"full\",\n \"domain_id\": null,\n \"expires_at\": \"2027-01-01 00:00:00\"\n}")

req, _ := http.NewRequest("POST", url, payload)

req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")

res, _ := http.DefaultClient.Do(req)

defer res.Body.Close()
body, _ := io.ReadAll(res.Body)

fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.post("https://api.sendkit.dev/api-keys")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"Production Key\",\n \"permission\": \"full\",\n \"domain_id\": null,\n \"expires_at\": \"2027-01-01 00:00:00\"\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.sendkit.dev/api-keys")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"Production Key\",\n \"permission\": \"full\",\n \"domain_id\": null,\n \"expires_at\": \"2027-01-01 00:00:00\"\n}"

response = http.request(request)
puts response.read_body
{
  "id": "550e8400-e29b-41d4-a716-446655440000",
  "name": "Production Key",
  "permission": "full",
  "domain_id": null,
  "status": "active",
  "expires_at": null,
  "last_used_at": "2026-03-03 10:00:00",
  "created_at": "2026-03-03 10:00:00",
  "token": "sk_aBcDeFgHiJkLmNoPqRsTuVwXyZ012345678901234567"
}
{
"message": "Invalid API key."
}
{
"message": "The email field is required."
}

Authorizations

Authorization
string
header
required

API key from your SendKit dashboard. Pass it as a Bearer token in the Authorization header.

Body

application/json
name
string
required

A descriptive name for the API key.

Maximum string length: 255
Example:

"Production Key"

permission
enum<string>
required

The permission level. full grants access to all endpoints, send only allows sending emails.

Available options:
full,
send
Example:

"full"

domain_id
string<uuid> | null

Scope the key to a specific domain. The domain must belong to your team.

Example:

null

expires_at
string<date-time> | null

When the API key should expire. Must be a future date. Null for no expiration.

Example:

"2027-01-01 00:00:00"

Response

API key created successfully. The token field contains the plain-text key.

id
string<uuid>

Unique identifier.

Example:

"550e8400-e29b-41d4-a716-446655440000"

name
string

The name of the API key.

Example:

"Production Key"

permission
enum<string>

The permission level. full grants access to all endpoints, send only allows sending emails.

Available options:
full,
send
Example:

"full"

domain_id
string<uuid> | null

The domain this key is scoped to. If null, the key can send from any verified domain.

Example:

null

status
string

The current status of the API key.

Example:

"active"

expires_at
string<date-time> | null

When the API key expires. Null if it does not expire.

Example:

null

last_used_at
string<date-time> | null

When the API key was last used.

Example:

"2026-03-03 10:00:00"

created_at
string<date-time>

When the API key was created.

Example:

"2026-03-03 10:00:00"

token
string

The plain-text API key. Only returned once at creation time.

Example:

"sk_aBcDeFgHiJkLmNoPqRsTuVwXyZ012345678901234567"