Create API Key
curl --request POST \
--url https://api.bunship.com/api/v1/organizations/{orgId}/api-keys \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"scopes": [
"<string>"
],
"rateLimit": 123,
"expiresAt": "<string>"
}
'import requests
url = "https://api.bunship.com/api/v1/organizations/{orgId}/api-keys"
payload = {
"name": "<string>",
"scopes": ["<string>"],
"rateLimit": 123,
"expiresAt": "<string>"
}
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: '<string>', scopes: ['<string>'], rateLimit: 123, expiresAt: '<string>'})
};
fetch('https://api.bunship.com/api/v1/organizations/{orgId}/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.bunship.com/api/v1/organizations/{orgId}/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' => '<string>',
'scopes' => [
'<string>'
],
'rateLimit' => 123,
'expiresAt' => '<string>'
]),
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.bunship.com/api/v1/organizations/{orgId}/api-keys"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"scopes\": [\n \"<string>\"\n ],\n \"rateLimit\": 123,\n \"expiresAt\": \"<string>\"\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.bunship.com/api/v1/organizations/{orgId}/api-keys")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"scopes\": [\n \"<string>\"\n ],\n \"rateLimit\": 123,\n \"expiresAt\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.bunship.com/api/v1/organizations/{orgId}/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\": \"<string>\",\n \"scopes\": [\n \"<string>\"\n ],\n \"rateLimit\": 123,\n \"expiresAt\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"data": {
"id": "key_abc123",
"name": "Production API",
"key": "bsk_live_abc123def456ghi789jkl012mno345pqr678stu901",
"prefix": "bsk_live_abc1",
"scopes": ["members:read", "webhooks:read"],
"rateLimit": 1000,
"expiresAt": null,
"createdAt": "2024-01-15T10:00:00Z"
},
"message": "API key created successfully. Save it now - you won't be able to see it again!"
}
API Keys
Create API Key
Create a new API key for the organization
POST
/
api
/
v1
/
organizations
/
{orgId}
/
api-keys
Create API Key
curl --request POST \
--url https://api.bunship.com/api/v1/organizations/{orgId}/api-keys \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"scopes": [
"<string>"
],
"rateLimit": 123,
"expiresAt": "<string>"
}
'import requests
url = "https://api.bunship.com/api/v1/organizations/{orgId}/api-keys"
payload = {
"name": "<string>",
"scopes": ["<string>"],
"rateLimit": 123,
"expiresAt": "<string>"
}
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: '<string>', scopes: ['<string>'], rateLimit: 123, expiresAt: '<string>'})
};
fetch('https://api.bunship.com/api/v1/organizations/{orgId}/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.bunship.com/api/v1/organizations/{orgId}/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' => '<string>',
'scopes' => [
'<string>'
],
'rateLimit' => 123,
'expiresAt' => '<string>'
]),
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.bunship.com/api/v1/organizations/{orgId}/api-keys"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"scopes\": [\n \"<string>\"\n ],\n \"rateLimit\": 123,\n \"expiresAt\": \"<string>\"\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.bunship.com/api/v1/organizations/{orgId}/api-keys")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"scopes\": [\n \"<string>\"\n ],\n \"rateLimit\": 123,\n \"expiresAt\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.bunship.com/api/v1/organizations/{orgId}/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\": \"<string>\",\n \"scopes\": [\n \"<string>\"\n ],\n \"rateLimit\": 123,\n \"expiresAt\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"data": {
"id": "key_abc123",
"name": "Production API",
"key": "bsk_live_abc123def456ghi789jkl012mno345pqr678stu901",
"prefix": "bsk_live_abc1",
"scopes": ["members:read", "webhooks:read"],
"rateLimit": 1000,
"expiresAt": null,
"createdAt": "2024-01-15T10:00:00Z"
},
"message": "API key created successfully. Save it now - you won't be able to see it again!"
}
Creates a new API key for the organization. The full key value is returned only once in this response. Store it securely — it cannot be retrieved again.
Auth
Requires a valid Bearer token. User must be a member of the organization.
Path Parameters
Organization identifier.
Request Body
Descriptive name for the API key. Between 1 and 100 characters.
Array of permission scopes to restrict what the key can access. If omitted or empty, the key has
full access to all organization resources.
Maximum requests per minute for this key. Minimum value of 1.
ISO 8601 date-time for when the key should expire. If omitted, the key does not expire.
Response
Always
true on success.Show data properties
Show data properties
API key identifier.
Key name.
The full API key value. Only shown once.
Key prefix for future identification.
Assigned permission scopes.
Requests per minute limit.
ISO 8601 expiration timestamp.
ISO 8601 creation timestamp.
Reminder to save the key.
{
"success": true,
"data": {
"id": "key_abc123",
"name": "Production API",
"key": "bsk_live_abc123def456ghi789jkl012mno345pqr678stu901",
"prefix": "bsk_live_abc1",
"scopes": ["members:read", "webhooks:read"],
"rateLimit": 1000,
"expiresAt": null,
"createdAt": "2024-01-15T10:00:00Z"
},
"message": "API key created successfully. Save it now - you won't be able to see it again!"
}
Example
curl -X POST https://api.bunship.com/api/v1/organizations/org_cld2abc123def456/api-keys \
-H "Authorization: Bearer eyJhbGciOiJIUzI1NiIs..." \
-H "Content-Type: application/json" \
-d '{
"name": "Production API",
"scopes": ["members:read", "webhooks:read"],
"rateLimit": 1000
}'
⌘I

