curl --request PATCH \
--url https://api.mixpeek.com/v1/organizations/users/{user_email}/api-keys/{key_name} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"description": "<string>",
"permissions": [],
"scopes": [
{
"description": "Full namespace access (data + infrastructure)",
"resource_id": "ns_production",
"resource_type": "namespace"
}
],
"rate_limit_override": 2,
"expires_at": "2023-11-07T05:31:56Z",
"allowed_origins": [
"https://docs.example.com",
"https://*.example.com"
]
}
'import requests
url = "https://api.mixpeek.com/v1/organizations/users/{user_email}/api-keys/{key_name}"
payload = {
"name": "<string>",
"description": "<string>",
"permissions": [],
"scopes": [
{
"description": "Full namespace access (data + infrastructure)",
"resource_id": "ns_production",
"resource_type": "namespace"
}
],
"rate_limit_override": 2,
"expires_at": "2023-11-07T05:31:56Z",
"allowed_origins": ["https://docs.example.com", "https://*.example.com"]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: '<string>',
description: '<string>',
permissions: [],
scopes: [
{
description: 'Full namespace access (data + infrastructure)',
resource_id: 'ns_production',
resource_type: 'namespace'
}
],
rate_limit_override: 2,
expires_at: '2023-11-07T05:31:56Z',
allowed_origins: ['https://docs.example.com', 'https://*.example.com']
})
};
fetch('https://api.mixpeek.com/v1/organizations/users/{user_email}/api-keys/{key_name}', 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.mixpeek.com/v1/organizations/users/{user_email}/api-keys/{key_name}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'name' => '<string>',
'description' => '<string>',
'permissions' => [
],
'scopes' => [
[
'description' => 'Full namespace access (data + infrastructure)',
'resource_id' => 'ns_production',
'resource_type' => 'namespace'
]
],
'rate_limit_override' => 2,
'expires_at' => '2023-11-07T05:31:56Z',
'allowed_origins' => [
'https://docs.example.com',
'https://*.example.com'
]
]),
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.mixpeek.com/v1/organizations/users/{user_email}/api-keys/{key_name}"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"permissions\": [],\n \"scopes\": [\n {\n \"description\": \"Full namespace access (data + infrastructure)\",\n \"resource_id\": \"ns_production\",\n \"resource_type\": \"namespace\"\n }\n ],\n \"rate_limit_override\": 2,\n \"expires_at\": \"2023-11-07T05:31:56Z\",\n \"allowed_origins\": [\n \"https://docs.example.com\",\n \"https://*.example.com\"\n ]\n}")
req, _ := http.NewRequest("PATCH", 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.patch("https://api.mixpeek.com/v1/organizations/users/{user_email}/api-keys/{key_name}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"permissions\": [],\n \"scopes\": [\n {\n \"description\": \"Full namespace access (data + infrastructure)\",\n \"resource_id\": \"ns_production\",\n \"resource_type\": \"namespace\"\n }\n ],\n \"rate_limit_override\": 2,\n \"expires_at\": \"2023-11-07T05:31:56Z\",\n \"allowed_origins\": [\n \"https://docs.example.com\",\n \"https://*.example.com\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.mixpeek.com/v1/organizations/users/{user_email}/api-keys/{key_name}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"permissions\": [],\n \"scopes\": [\n {\n \"description\": \"Full namespace access (data + infrastructure)\",\n \"resource_id\": \"ns_production\",\n \"resource_type\": \"namespace\"\n }\n ],\n \"rate_limit_override\": 2,\n \"expires_at\": \"2023-11-07T05:31:56Z\",\n \"allowed_origins\": [\n \"https://docs.example.com\",\n \"https://*.example.com\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"created_at": "2025-01-01T00:00:00Z",
"created_by": "usr_admin",
"description": "Service account for ingestion",
"internal_id": "int_x1y2z3",
"key_hash": "2c26b46b68ffc68ff99b453c1d304134",
"key_id": "key_a1b2c3d4e5f6g7h",
"key_prefix": "sk_abc123...",
"name": "backend-service",
"organization_id": "org_demo123",
"permissions": [
"read",
"write"
],
"scopes": [],
"status": "active",
"user_id": "usr_a1b2c3d4e5f6g7h"
}{
"error": {
"details": {
"id": "ns_123",
"resource": "namespace"
},
"message": "Namespace not found",
"type": "NotFoundError"
},
"status": 404,
"success": false
}{
"error": {
"details": {
"id": "ns_123",
"resource": "namespace"
},
"message": "Namespace not found",
"type": "NotFoundError"
},
"status": 404,
"success": false
}{
"error": {
"details": {
"id": "ns_123",
"resource": "namespace"
},
"message": "Namespace not found",
"type": "NotFoundError"
},
"status": 404,
"success": false
}{
"error": {
"details": {
"id": "ns_123",
"resource": "namespace"
},
"message": "Namespace not found",
"type": "NotFoundError"
},
"status": 404,
"success": false
}{
"error": {
"details": {
"id": "ns_123",
"resource": "namespace"
},
"message": "Namespace not found",
"type": "NotFoundError"
},
"status": 404,
"success": false
}{
"error": {
"details": {
"id": "ns_123",
"resource": "namespace"
},
"message": "Namespace not found",
"type": "NotFoundError"
},
"status": 404,
"success": false
}{
"error": {
"details": {
"id": "ns_123",
"resource": "namespace"
},
"message": "Namespace not found",
"type": "NotFoundError"
},
"status": 404,
"success": false
}{
"error": {
"details": {
"id": "ns_123",
"resource": "namespace"
},
"message": "Namespace not found",
"type": "NotFoundError"
},
"status": 404,
"success": false
}Update Api Key
Update an API keyās metadata or permissions.
š The āadmin-keyā is protected and cannot be modified.
curl --request PATCH \
--url https://api.mixpeek.com/v1/organizations/users/{user_email}/api-keys/{key_name} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"description": "<string>",
"permissions": [],
"scopes": [
{
"description": "Full namespace access (data + infrastructure)",
"resource_id": "ns_production",
"resource_type": "namespace"
}
],
"rate_limit_override": 2,
"expires_at": "2023-11-07T05:31:56Z",
"allowed_origins": [
"https://docs.example.com",
"https://*.example.com"
]
}
'import requests
url = "https://api.mixpeek.com/v1/organizations/users/{user_email}/api-keys/{key_name}"
payload = {
"name": "<string>",
"description": "<string>",
"permissions": [],
"scopes": [
{
"description": "Full namespace access (data + infrastructure)",
"resource_id": "ns_production",
"resource_type": "namespace"
}
],
"rate_limit_override": 2,
"expires_at": "2023-11-07T05:31:56Z",
"allowed_origins": ["https://docs.example.com", "https://*.example.com"]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: '<string>',
description: '<string>',
permissions: [],
scopes: [
{
description: 'Full namespace access (data + infrastructure)',
resource_id: 'ns_production',
resource_type: 'namespace'
}
],
rate_limit_override: 2,
expires_at: '2023-11-07T05:31:56Z',
allowed_origins: ['https://docs.example.com', 'https://*.example.com']
})
};
fetch('https://api.mixpeek.com/v1/organizations/users/{user_email}/api-keys/{key_name}', 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.mixpeek.com/v1/organizations/users/{user_email}/api-keys/{key_name}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'name' => '<string>',
'description' => '<string>',
'permissions' => [
],
'scopes' => [
[
'description' => 'Full namespace access (data + infrastructure)',
'resource_id' => 'ns_production',
'resource_type' => 'namespace'
]
],
'rate_limit_override' => 2,
'expires_at' => '2023-11-07T05:31:56Z',
'allowed_origins' => [
'https://docs.example.com',
'https://*.example.com'
]
]),
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.mixpeek.com/v1/organizations/users/{user_email}/api-keys/{key_name}"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"permissions\": [],\n \"scopes\": [\n {\n \"description\": \"Full namespace access (data + infrastructure)\",\n \"resource_id\": \"ns_production\",\n \"resource_type\": \"namespace\"\n }\n ],\n \"rate_limit_override\": 2,\n \"expires_at\": \"2023-11-07T05:31:56Z\",\n \"allowed_origins\": [\n \"https://docs.example.com\",\n \"https://*.example.com\"\n ]\n}")
req, _ := http.NewRequest("PATCH", 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.patch("https://api.mixpeek.com/v1/organizations/users/{user_email}/api-keys/{key_name}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"permissions\": [],\n \"scopes\": [\n {\n \"description\": \"Full namespace access (data + infrastructure)\",\n \"resource_id\": \"ns_production\",\n \"resource_type\": \"namespace\"\n }\n ],\n \"rate_limit_override\": 2,\n \"expires_at\": \"2023-11-07T05:31:56Z\",\n \"allowed_origins\": [\n \"https://docs.example.com\",\n \"https://*.example.com\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.mixpeek.com/v1/organizations/users/{user_email}/api-keys/{key_name}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"permissions\": [],\n \"scopes\": [\n {\n \"description\": \"Full namespace access (data + infrastructure)\",\n \"resource_id\": \"ns_production\",\n \"resource_type\": \"namespace\"\n }\n ],\n \"rate_limit_override\": 2,\n \"expires_at\": \"2023-11-07T05:31:56Z\",\n \"allowed_origins\": [\n \"https://docs.example.com\",\n \"https://*.example.com\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"created_at": "2025-01-01T00:00:00Z",
"created_by": "usr_admin",
"description": "Service account for ingestion",
"internal_id": "int_x1y2z3",
"key_hash": "2c26b46b68ffc68ff99b453c1d304134",
"key_id": "key_a1b2c3d4e5f6g7h",
"key_prefix": "sk_abc123...",
"name": "backend-service",
"organization_id": "org_demo123",
"permissions": [
"read",
"write"
],
"scopes": [],
"status": "active",
"user_id": "usr_a1b2c3d4e5f6g7h"
}{
"error": {
"details": {
"id": "ns_123",
"resource": "namespace"
},
"message": "Namespace not found",
"type": "NotFoundError"
},
"status": 404,
"success": false
}{
"error": {
"details": {
"id": "ns_123",
"resource": "namespace"
},
"message": "Namespace not found",
"type": "NotFoundError"
},
"status": 404,
"success": false
}{
"error": {
"details": {
"id": "ns_123",
"resource": "namespace"
},
"message": "Namespace not found",
"type": "NotFoundError"
},
"status": 404,
"success": false
}{
"error": {
"details": {
"id": "ns_123",
"resource": "namespace"
},
"message": "Namespace not found",
"type": "NotFoundError"
},
"status": 404,
"success": false
}{
"error": {
"details": {
"id": "ns_123",
"resource": "namespace"
},
"message": "Namespace not found",
"type": "NotFoundError"
},
"status": 404,
"success": false
}{
"error": {
"details": {
"id": "ns_123",
"resource": "namespace"
},
"message": "Namespace not found",
"type": "NotFoundError"
},
"status": 404,
"success": false
}{
"error": {
"details": {
"id": "ns_123",
"resource": "namespace"
},
"message": "Namespace not found",
"type": "NotFoundError"
},
"status": 404,
"success": false
}{
"error": {
"details": {
"id": "ns_123",
"resource": "namespace"
},
"message": "Namespace not found",
"type": "NotFoundError"
},
"status": 404,
"success": false
}Authorizations
Mixpeek API key, sent as Authorization: Bearer mxp_sk_.... Create one in Studio under Settings ā API Keys, or with an admin key via POST /v1/organizations/users/{user_email}/api-keys. A missing, malformed, unknown, revoked, inactive or expired key returns 401; a key without the permission, scope or plan an operation needs returns 403.
Body
Keys this body does not declare are refused with 422 extra_forbidden naming the accepted keys (since 2026-11-02).
Partial update payload for an API key.
Replace existing permissions with the provided list.
Simplified API key permissions.
This four-value enum replaces the legacy 16-permission model. Keep usage simple: prefer the least privileged option that satisfies the workflow.
Hierarchy (strongest -> weakest): ADMIN > DELETE > WRITE > READ.
read, write, delete, admin Response
Successful Response
API key document stored in MongoDB.
Visible prefix of the API key for user identification (e.g., 'sk_abc123...'). Shows the first 10 characters of the plaintext key to help users identify which key is which in lists, without exposing the full secret. This follows industry best practices from GitHub, Stripe, and AWS. Generated automatically for new keys. Older keys may not have this field.
64"sk_abc123..."
SERVER-VERIFIED internal-actor marker. When True, this key belongs to Mixpeek's own operations (e.g. the in-org ops/health probe that must authenticate under a dedicated tenant's internal_id because the single-tenant pod gate fail-closes cross-org auth) and its usage is NOT billed to the org: accrue_mvs_usage skips the accrual and consume_credits skips the direct charge. FAIL CLOSED ā absent/False means BILL. This is the ONLY server-side source a billing skip may key on; never the client-influenced X-Mixpeek-Traffic header or mixpeek-loop-* User-Agent. Set only by an admin provisioning an internal key, never from a create request.
Permissions granted to the key.
Simplified API key permissions.
This four-value enum replaces the legacy 16-permission model. Keep usage simple: prefer the least privileged option that satisfies the workflow.
Hierarchy (strongest -> weakest): ADMIN > DELETE > WRITE > READ.
read, write, delete, admin Optional list of allowed HTTP origins for this API key. When set, requests must include an Origin header matching one of these values. Supports exact matches (e.g., 'https://docs.example.com') and wildcard subdomains (e.g., 'https://*.example.com'). Only enforced for browser requests (defense-in-depth, not a security boundary). Null means no origin restriction.
[
"https://docs.example.com",
"https://*.example.com"
]
Was this page helpful?

