Provision an org
curl --request POST \
--url https://api.craftkit.dev/v1/admin/provision \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"externalOrgId": "org_123",
"orgName": "Acme Corp"
}
'import requests
url = "https://api.craftkit.dev/v1/admin/provision"
payload = {
"externalOrgId": "org_123",
"orgName": "Acme Corp"
}
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({externalOrgId: 'org_123', orgName: 'Acme Corp'})
};
fetch('https://api.craftkit.dev/v1/admin/provision', 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.craftkit.dev/v1/admin/provision",
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([
'externalOrgId' => 'org_123',
'orgName' => 'Acme Corp'
]),
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.craftkit.dev/v1/admin/provision"
payload := strings.NewReader("{\n \"externalOrgId\": \"org_123\",\n \"orgName\": \"Acme Corp\"\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.craftkit.dev/v1/admin/provision")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"externalOrgId\": \"org_123\",\n \"orgName\": \"Acme Corp\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.craftkit.dev/v1/admin/provision")
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 \"externalOrgId\": \"org_123\",\n \"orgName\": \"Acme Corp\"\n}"
response = http.request(request)
puts response.read_body{
"projectId": "7c9f0b2e-2b1a-4f3d-9c8e-1a2b3c4d5e6f",
"partnerId": "9a8b7c6d-5e4f-3a2b-1c0d-9e8f7a6b5c4d",
"apiKey": "ck_live_xxxxxxxxxxxx",
"alreadyExisted": false
}{
"error": "<string>",
"message": "<string>",
"issues": "<unknown>",
"detail": "<string>"
}{
"error": "invalid_credentials"
}{
"error": "externalOrgId is required"
}{
"error": "<string>",
"message": "<string>",
"issues": "<unknown>",
"detail": "<string>"
}Admin
Provision an org
Idempotently provision a Craftkit project + API key + embed partner for an external org id. The first call returns the plaintext API key (store it — it cannot be recovered later); subsequent calls decrypt and return the same key. Authenticated by the deployment admin key.
POST
/
v1
/
admin
/
provision
Provision an org
curl --request POST \
--url https://api.craftkit.dev/v1/admin/provision \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"externalOrgId": "org_123",
"orgName": "Acme Corp"
}
'import requests
url = "https://api.craftkit.dev/v1/admin/provision"
payload = {
"externalOrgId": "org_123",
"orgName": "Acme Corp"
}
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({externalOrgId: 'org_123', orgName: 'Acme Corp'})
};
fetch('https://api.craftkit.dev/v1/admin/provision', 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.craftkit.dev/v1/admin/provision",
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([
'externalOrgId' => 'org_123',
'orgName' => 'Acme Corp'
]),
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.craftkit.dev/v1/admin/provision"
payload := strings.NewReader("{\n \"externalOrgId\": \"org_123\",\n \"orgName\": \"Acme Corp\"\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.craftkit.dev/v1/admin/provision")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"externalOrgId\": \"org_123\",\n \"orgName\": \"Acme Corp\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.craftkit.dev/v1/admin/provision")
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 \"externalOrgId\": \"org_123\",\n \"orgName\": \"Acme Corp\"\n}"
response = http.request(request)
puts response.read_body{
"projectId": "7c9f0b2e-2b1a-4f3d-9c8e-1a2b3c4d5e6f",
"partnerId": "9a8b7c6d-5e4f-3a2b-1c0d-9e8f7a6b5c4d",
"apiKey": "ck_live_xxxxxxxxxxxx",
"alreadyExisted": false
}{
"error": "<string>",
"message": "<string>",
"issues": "<unknown>",
"detail": "<string>"
}{
"error": "invalid_credentials"
}{
"error": "externalOrgId is required"
}{
"error": "<string>",
"message": "<string>",
"issues": "<unknown>",
"detail": "<string>"
}Authorizations
Deployment-wide admin secret (CRAFTKIT_ADMIN_KEY). Admin provisioning only.
⌘I