Provider keys
Create a provider key
Create a new provider key for the organization. The API key is encrypted at rest.
POST
/api/provider-keysbetter-auth.session_token<token>
Cookie session from Better Auth. Requires X-Org-Id header for org-scoped routes.
In: cookie
Header Parameters
X-Org-Id?string
Organization ID. Required for cookie auth. Not needed for API key auth (org resolved from key).
Format
uuidRequest Body
application/json
curl -X POST "https://loading/api/provider-keys" \ -H "Content-Type: application/json" \ -d '{ "label": "string", "api": "string", "baseUrl": "http://example.com", "apiKey": "string" }'{
"id": "string"
}{
"type": "https://docs.appstrate.dev/errors/invalid-request",
"title": "Invalid Request",
"status": 400,
"detail": "Field is required",
"code": "invalid_request",
"requestId": "req_abc123"
}{
"type": "https://docs.appstrate.dev/errors/forbidden",
"title": "Forbidden",
"status": 403,
"detail": "Insufficient permissions",
"code": "forbidden",
"requestId": "req_abc123"
}