API Keys
Create API key
Create a new API key for a project with specified permissions. Requires organization-level authentication (JWT Bearer token). API keys are not supported for this endpoint.
POST
/api/api-keysSDK setup
Create a client and set credentials (JWT and/or API key) before calling the API. Match the authentication type shown above.
import { Configuration, APIKeysApi } from 'mudbase-sdk';
const configuration = new Configuration({
basePath: 'https://cloud.mudbase.dev',
accessToken: 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJ1c3JfbW9yZ2FuX2RlIiwiZW1haWwiOiJtb3JnYW4uY2hlbkBub3J0aHdpbmQuZGV2IiwiZXhwIjoxODI1MTI5NjAwfQ.doc_preview_sig',
});
const apikeys = new APIKeysApi(configuration);import { Configuration, APIKeysApi } from 'mudbase-sdk';
const configuration = new Configuration({
basePath: 'https://cloud.mudbase.dev',
accessToken: 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJ1c3JfbW9yZ2FuX2RlIiwiZW1haWwiOiJtb3JnYW4uY2hlbkBub3J0aHdpbmQuZGV2IiwiZXhwIjoxODI1MTI5NjAwfQ.doc_preview_sig',
});
const apikeys = new APIKeysApi(configuration);Example request
Call this endpoint using the client from SDK setup. Use View HTTP for a raw cURL example.
const { data: result } = await apikeys.createApiKey(
{
name: "Verna Parker Jr.",
projectId: "proj_Bs96lvsGKI6O",
permissions: "protocol bypass",
rateLimit: "430.883.2561",
expiresAt: "monitor hack"
}
);const { data: result } = await apikeys.createApiKey(
{
name: "Verna Parker Jr.",
projectId: "proj_Bs96lvsGKI6O",
permissions: "protocol bypass",
rateLimit: "430.883.2561",
expiresAt: "monitor hack"
}
);Playground
liveTest this endpoint with your own credentials. Your requests will be sent to the live API.
Use the auth endpoints to obtain a JWT.
No Request Yet
Send a request to see the full inspector
Authentication
Requires JWT
Note
Include your JWT in the
Authorization: Bearer YOUR_TOKEN header (user-facing apps, RBAC). View authentication guide →Request Body
json
{
"name": "Johnathan Torp I",
"projectId": "proj_qh5hFHNT70YZ",
"permissions": [
{
"resource": "database",
"actions": [
"create"
]
}
],
"rateLimit": {
"requests": 53618,
"window": 73989
},
"expiresAt": "2026-06-23T06:45:05.281Z"
}{
"name": "Johnathan Torp I",
"projectId": "proj_qh5hFHNT70YZ",
"permissions": [
{
"resource": "database",
"actions": [
"create"
]
}
],
"rateLimit": {
"requests": 53618,
"window": 73989
},
"expiresAt": "2026-06-23T06:45:05.281Z"
}Responses
201API key created
json
{
"message": "API key created successfully",
"apiKey": {
"_id": "685ae8a785426b6a4190d5fc",
"name": "Production API Key",
"secret": "mudbase_sk_live_<api-key-secret>",
"project": {
"_id": "685ad30be129932fbb7a1047",
"name": "Mudbase Platform",
"slug": "mudbase-platform"
},
"permissions": [
{
"resource": "database",
"actions": [
"create",
"read",
"update",
"delete"
]
},
{
"resource": "storage",
"actions": [
"read",
"create",
"update",
"delete"
]
}
],
"isActive": true,
"createdAt": "2024-01-15T10:00:00.000Z",
"expiresAt": "2025-12-31T23:59:59.000Z"
}
}{
"message": "API key created successfully",
"apiKey": {
"_id": "685ae8a785426b6a4190d5fc",
"name": "Production API Key",
"secret": "mudbase_sk_live_<api-key-secret>",
"project": {
"_id": "685ad30be129932fbb7a1047",
"name": "Mudbase Platform",
"slug": "mudbase-platform"
},
"permissions": [
{
"resource": "database",
"actions": [
"create",
"read",
"update",
"delete"
]
},
{
"resource": "storage",
"actions": [
"read",
"create",
"update",
"delete"
]
}
],
"isActive": true,
"createdAt": "2024-01-15T10:00:00.000Z",
"expiresAt": "2025-12-31T23:59:59.000Z"
}
}400Validation failed (e.g. invalid permissions format, invalid or past expiresAt)
json
{
"error": "Validation failed",
"details": [
"\"permissions[0]\" must be of type object",
"\"expiresAt\" must be a valid date"
]
}{
"error": "Validation failed",
"details": [
"\"permissions[0]\" must be of type object",
"\"expiresAt\" must be a valid date"
]
}Errors
| Code | Meaning |
|---|---|
400 | Validation failed (e.g. invalid permissions format, invalid or past expiresAt) |