API ReferenceDeveloper
Create or regenerate an API key
Creates a new API key of the specified type, or regenerates an existing one. Each merchant can have one live key and one test key. If a key of the requested type already exists, it is revoked and replaced.
The full key is returned only in this response. Store it securely — you will not be able to retrieve it again.
Authorization
privy AuthorizationBearer <token>
Privy JWT authentication for dashboard and management endpoints. This is used internally by the Bag Dashboard and is not intended for direct API integrations. Use API keys instead.
In: header
Request Body
application/json
TypeScript Definitions
Use the request body type in TypeScript.
Response Body
application/json
application/json
application/json
curl -X POST "https://api.justusebag.xyz/api/developer/keys" \ -H "Content-Type: application/json" \ -d '{ "keyType": "test" }'{
"status": "success",
"data": {
"fullKey": "bag_test_sk_a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6e7f8a9b0c1d2e3f4",
"keyType": "test",
"keyPrefix": "bag_test_sk_a1b2",
"keySuffix": "e3f4"
}
}{
"status": "error",
"message": "Invalid or revoked API key",
"code": "UNAUTHORIZED",
"hint": "Include a valid API key in the Authorization header: Bearer bag_live_sk_..."
}{
"status": "error",
"message": "Too many requests. Please slow down.",
"retryAfter": 10
}