Create API key
Mints a new revocable API key. key is the raw secret (prefix
fuse_sk_) and appears only in this response; it cannot be
recovered afterward — only its SHA-256 is stored. An empty body
creates an unlabeled key; only a present-but-malformed body is
400. Master-token only: a caller authenticated with an API key
receives 403, and the 403 body carries code unauthorized (not
a separate forbidden code). Auth is never disabled on this
route: it exists only when the Postgres key store is configured,
and that same store makes bearer auth mandatory, so every
request reaching this handler carries a principal. Requires the
Postgres-backed key store (DATABASE_URL); without it this
route is not registered and returns 404 route_not_found.
Note that ORCH_AUTH_TOKEN unset with DATABASE_URL set is
permitted (unless ORCH_REQUIRE_AUTH=true), and in that
configuration there is no master credential at all: every caller
authenticates as an API key and therefore receives 403
unauthorized here. Configure a master token to use this route.
/v1/api-keysAuthorizationBearer token · headerrequiredfuse_sessionAPI key · cookierequiredapplication/jsonlabelstringidstringrequiredlabelstringcreated_atstring<date-time>requiredlast_used_atstring<date-time>revoked_atstring<date-time>keystringrequirederrorobjectrequiredShow propertiesHide properties
codestringrequirednot_foundroute_not_foundconflictinvalid_argumentunauthorizedforbiddenunavailableinternalunimplementedmessagestringrequireddetailsobjecterrorobjectrequiredShow propertiesHide properties
codestringrequirednot_foundroute_not_foundconflictinvalid_argumentunauthorizedforbiddenunavailableinternalunimplementedmessagestringrequireddetailsobjecterrorobjectrequiredShow propertiesHide properties
codestringrequirednot_foundroute_not_foundconflictinvalid_argumentunauthorizedforbiddenunavailableinternalunimplementedmessagestringrequireddetailsobjecterrorobjectrequiredShow propertiesHide properties
codestringrequirednot_foundroute_not_foundconflictinvalid_argumentunauthorizedforbiddenunavailableinternalunimplementedmessagestringrequireddetailsobjecterrorobjectrequiredShow propertiesHide properties
codestringrequirednot_foundroute_not_foundconflictinvalid_argumentunauthorizedforbiddenunavailableinternalunimplementedmessagestringrequireddetailsobjectcurl -X POST "http://localhost:8080/v1/api-keys" \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"label": "string"
}'const response = await fetch("http://localhost:8080/v1/api-keys", {
method: "POST",
headers: {
"Authorization": "Bearer YOUR_TOKEN",
"Content-Type": "application/json"
},
body: JSON.stringify({
"label": "string"
})
});import requests
response = requests.post(
"http://localhost:8080/v1/api-keys",
headers={
"Authorization": "Bearer YOUR_TOKEN",
"Content-Type": "application/json"
},
json={
"label": "string"
},
){
"id": "string",
"label": "string",
"created_at": "2024-01-01T00:00:00Z",
"last_used_at": "2024-01-01T00:00:00Z",
"revoked_at": "2024-01-01T00:00:00Z",
"key": "string"
}{
"error": {
"code": "not_found",
"message": "string",
"details": {}
}
}{
"error": {
"code": "not_found",
"message": "string",
"details": {}
}
}{
"error": {
"code": "not_found",
"message": "string",
"details": {}
}
}{
"error": {
"code": "not_found",
"message": "string",
"details": {}
}
}{
"error": {
"code": "not_found",
"message": "string",
"details": {}
}
}