Create an API key in this organization
curl --request POST \
--url https://api.01ads.com/v1/organizations/{orgSlug}/api-keys \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "ci-deploy",
"level": "organization",
"role": "admin",
"expiresInDays": 90
}
'import requests
url = "https://api.01ads.com/v1/organizations/{orgSlug}/api-keys"
payload = {
"name": "ci-deploy",
"level": "organization",
"role": "admin",
"expiresInDays": 90
}
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: 'ci-deploy', level: 'organization', role: 'admin', expiresInDays: 90})
};
fetch('https://api.01ads.com/v1/organizations/{orgSlug}/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.01ads.com/v1/organizations/{orgSlug}/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' => 'ci-deploy',
'level' => 'organization',
'role' => 'admin',
'expiresInDays' => 90
]),
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.01ads.com/v1/organizations/{orgSlug}/api-keys"
payload := strings.NewReader("{\n \"name\": \"ci-deploy\",\n \"level\": \"organization\",\n \"role\": \"admin\",\n \"expiresInDays\": 90\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.01ads.com/v1/organizations/{orgSlug}/api-keys")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"ci-deploy\",\n \"level\": \"organization\",\n \"role\": \"admin\",\n \"expiresInDays\": 90\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.01ads.com/v1/organizations/{orgSlug}/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\": \"ci-deploy\",\n \"level\": \"organization\",\n \"role\": \"admin\",\n \"expiresInDays\": 90\n}"
response = http.request(request)
puts response.read_body{
"id": "key_3f9a2c",
"name": "ci-deploy",
"prefix": "01ads_3f9a2c7e1b",
"level": "organization",
"role": "admin",
"workspace": null,
"workspaceSlug": null,
"creatorEmail": "ada@acme-corp.com",
"status": "active",
"createdAt": "2026-09-01T09:00:00.000Z",
"expiresAt": "2026-11-30T09:00:00.000Z",
"lastRequest": null,
"key": "01ads_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
}{
"type": "about:blank",
"title": "Validation Failed",
"status": 400,
"detail": "The request does not match the expected schema.",
"instance": "/v1/organizations/acme-corp/workspaces",
"requestId": "7c1b0c1e-5b7d-4b2a-9f1e-3c2d1a0b9e8f",
"errors": [
{
"path": "name",
"message": "Too small: expected string to have >=1 characters"
}
]
}{
"type": "about:blank",
"title": "Unauthorized",
"status": 401,
"detail": "Authentication required. Sign in and try again.",
"instance": "/v1/organizations",
"requestId": "2f6a9c3d-1e4b-4a8c-b7d2-5e0f1a2b3c4d"
}{
"type": "about:blank",
"title": "Unauthorized",
"status": 401,
"instance": "/v1/me",
"detail": "<string>",
"requestId": "<string>",
"errors": [
{
"path": "<string>",
"message": "<string>"
}
]
}{
"type": "about:blank",
"title": "Not Found",
"status": 404,
"detail": "Organization not found.",
"instance": "/v1/organizations/no-such-org",
"requestId": "a1b2c3d4-9e8f-4d7c-8b6a-5f4e3d2c1b0a"
}api-keys
Create an API key in this organization
Every key is bound to this organization. User-level keys act as their creator here; organization/workspace keys carry a fixed role and require the corresponding admin standing. The raw key appears only in this response.
POST
/
v1
/
organizations
/
{orgSlug}
/
api-keys
Create an API key in this organization
curl --request POST \
--url https://api.01ads.com/v1/organizations/{orgSlug}/api-keys \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "ci-deploy",
"level": "organization",
"role": "admin",
"expiresInDays": 90
}
'import requests
url = "https://api.01ads.com/v1/organizations/{orgSlug}/api-keys"
payload = {
"name": "ci-deploy",
"level": "organization",
"role": "admin",
"expiresInDays": 90
}
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: 'ci-deploy', level: 'organization', role: 'admin', expiresInDays: 90})
};
fetch('https://api.01ads.com/v1/organizations/{orgSlug}/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.01ads.com/v1/organizations/{orgSlug}/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' => 'ci-deploy',
'level' => 'organization',
'role' => 'admin',
'expiresInDays' => 90
]),
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.01ads.com/v1/organizations/{orgSlug}/api-keys"
payload := strings.NewReader("{\n \"name\": \"ci-deploy\",\n \"level\": \"organization\",\n \"role\": \"admin\",\n \"expiresInDays\": 90\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.01ads.com/v1/organizations/{orgSlug}/api-keys")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"ci-deploy\",\n \"level\": \"organization\",\n \"role\": \"admin\",\n \"expiresInDays\": 90\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.01ads.com/v1/organizations/{orgSlug}/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\": \"ci-deploy\",\n \"level\": \"organization\",\n \"role\": \"admin\",\n \"expiresInDays\": 90\n}"
response = http.request(request)
puts response.read_body{
"id": "key_3f9a2c",
"name": "ci-deploy",
"prefix": "01ads_3f9a2c7e1b",
"level": "organization",
"role": "admin",
"workspace": null,
"workspaceSlug": null,
"creatorEmail": "ada@acme-corp.com",
"status": "active",
"createdAt": "2026-09-01T09:00:00.000Z",
"expiresAt": "2026-11-30T09:00:00.000Z",
"lastRequest": null,
"key": "01ads_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
}{
"type": "about:blank",
"title": "Validation Failed",
"status": 400,
"detail": "The request does not match the expected schema.",
"instance": "/v1/organizations/acme-corp/workspaces",
"requestId": "7c1b0c1e-5b7d-4b2a-9f1e-3c2d1a0b9e8f",
"errors": [
{
"path": "name",
"message": "Too small: expected string to have >=1 characters"
}
]
}{
"type": "about:blank",
"title": "Unauthorized",
"status": 401,
"detail": "Authentication required. Sign in and try again.",
"instance": "/v1/organizations",
"requestId": "2f6a9c3d-1e4b-4a8c-b7d2-5e0f1a2b3c4d"
}{
"type": "about:blank",
"title": "Unauthorized",
"status": 401,
"instance": "/v1/me",
"detail": "<string>",
"requestId": "<string>",
"errors": [
{
"path": "<string>",
"message": "<string>"
}
]
}{
"type": "about:blank",
"title": "Not Found",
"status": 404,
"detail": "Organization not found.",
"instance": "/v1/organizations/no-such-org",
"requestId": "a1b2c3d4-9e8f-4d7c-8b6a-5f4e3d2c1b0a"
}Authorizations
Session token as Authorization: Bearer (the CLI and scripts).
Path Parameters
Body
application/json
Response
Created
The first 15 characters of the key, for display; keys minted before this was stored hold only 01ads_
Available options:
user, organization, workspace Available options:
admin, member, viewer, null Workspace name (workspace keys)
Workspace slug (workspace keys)
Who created the key
Effective status; expired once the expiry has passed
Available options:
active, disabled, expired, revoked ISO timestamp, or null = never
The raw key — shown exactly once
Was this page helpful?