A site posts its public key with its enrollment code
const url = 'https://example.com/v1/auth/sites/enroll';const options = { method: 'POST', headers: {'Content-Type': 'application/json'}, body: '{"code":"example","publicKey":{}}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://example.com/v1/auth/sites/enroll \ --header 'Content-Type: application/json' \ --data '{ "code": "example", "publicKey": {} }'Public: the code is the credential. The site keeps its private key; Kindgi stores the public one, and answers the site’s id (its statements’ iss) and the audience (their aud). A wrong, used or expired code, or one for a paused or unregistered site, gets one answer: 401 site-enrollment-refused. Once the code checks out, a key this site retired, or another site in the workspace at the same address retired, is refused unless it’s live on this site now (409 site-enrollment-key-retired), and the code isn’t used up. Failures are limited per client (429 rate-limit-exceeded, with Retry-After). The body is at most 4096 bytes.
Request Bodyrequired
Section titled “Request Bodyrequired”object
The site’s Ed25519 public key, a JWK: kty: OKP, crv: Ed25519, x and kid.
object
Examplegenerated
{ "code": "example", "publicKey": {}}Responses
Section titled “Responses”The site’s id and its statements’ audience.
object
What the site’s statements carry as iss.
What the site’s statements carry as aud.
Examplegenerated
{ "siteId": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "audience": "example"}A malformed body, or a public key that isn’t an Ed25519 JWK with a kid, or has a private part (site-key-invalid); it’s checked before the code.
object
object
Stable machine-readable discriminant. Values match domain error codes (see docs/API-ROUTE-CONVENTIONS.md §4.3).
Optional, kind-specific.
object
Server-assigned request id; also echoed via X-Request-Id header.
Examplegenerated
{ "error": { "code": "example", "message": "example", "details": {}, "requestId": "example" }}The code was refused (site-enrollment-refused).
object
object
Stable machine-readable discriminant. Values match domain error codes (see docs/API-ROUTE-CONVENTIONS.md §4.3).
Optional, kind-specific.
object
Server-assigned request id; also echoed via X-Request-Id header.
Examplegenerated
{ "error": { "code": "example", "message": "example", "details": {}, "requestId": "example" }}The key was retired at this site, or at another site in the workspace at the same address, and it isn’t live on this site (site-enrollment-key-retired). The code isn’t used up.
object
object
Stable machine-readable discriminant. Values match domain error codes (see docs/API-ROUTE-CONVENTIONS.md §4.3).
Optional, kind-specific.
object
Server-assigned request id; also echoed via X-Request-Id header.
Examplegenerated
{ "error": { "code": "example", "message": "example", "details": {}, "requestId": "example" }}The body is over 4096 bytes (site-request-too-large).
object
object
Stable machine-readable discriminant. Values match domain error codes (see docs/API-ROUTE-CONVENTIONS.md §4.3).
Optional, kind-specific.
object
Server-assigned request id; also echoed via X-Request-Id header.
Examplegenerated
{ "error": { "code": "example", "message": "example", "details": {}, "requestId": "example" }}Too many failures from this client; Retry-After says when to try again.
object
object
Stable machine-readable discriminant. Values match domain error codes (see docs/API-ROUTE-CONVENTIONS.md §4.3).
Optional, kind-specific.
object
Server-assigned request id; also echoed via X-Request-Id header.
Examplegenerated
{ "error": { "code": "example", "message": "example", "details": {}, "requestId": "example" }}Headers
Section titled “Headers”Whole seconds to wait before sending the request again, at least 1. Sent with the codes the answer names as sending it, so it may be absent.
The authorization store couldn’t be reached (authz-backend-unavailable), or the database was too busy for the authorization check (database-busy), so the request wasn’t run; Retry-After (whole seconds) says when to try again.
object
object
Stable machine-readable discriminant. Values match domain error codes (see docs/API-ROUTE-CONVENTIONS.md §4.3).
Optional, kind-specific.
object
Server-assigned request id; also echoed via X-Request-Id header.
Examplegenerated
{ "error": { "code": "example", "message": "example", "details": {}, "requestId": "example" }}Headers
Section titled “Headers”Whole seconds to wait before sending the request again, at least 1. Sent with the codes the answer names as sending it, so it may be absent.