Let people at an email domain join the workspace
const url = 'https://example.com/v1/auth/join-domains';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"domain":"example","role":"viewer"}'};
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/join-domains \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "domain": "example", "role": "viewer" }'Letting more people in takes a person who’s a tenant admin, for the domain of the email their session’s sign-in proved, exactly (not a subdomain, nor the parent), signed in by a way that counts for it; or the deployment’s operator (kindgi:system). An API key or a service account has no proved email, so it can’t. When the operator manages sign-in (KINDGI_AUTH_TENANT_PROVIDERS=off), only the operator can. Never a public mailbox domain (gmail.com, outlook.com, …), nor a domain the operator verified for another workspace. It needs the deployment’s authorization store, so a joiner’s role can be checked. The first rule that fails answers: the caller, a public domain, another workspace’s domain, the authorization store, a domain allowed already. Audited.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Header Parameters
Section titled “Header Parameters”Request Bodyrequired
Section titled “Request Bodyrequired”A domain to let people join from.
object
Responses
Section titled “Responses”Allowed.
An email domain the workspace lets people join from.
object
Example
{ "role": "viewer"}A body that isn’t { domain, role? }, or a domain that isn’t one (bad-input); a public mailbox domain (join-domain-public).
object
Examplegenerated
{ "error": { "code": "example", "message": "example", "details": {}, "requestId": "example" }}Missing / malformed / expired / revoked bearer token.
object
Examplegenerated
{ "error": { "code": "example", "message": "example", "details": {}, "requestId": "example" }}Not a tenant admin (permission-denied). Without an authorization store, a tenant admin is the deployment’s API token, an admin key, or a console signed in with either. Not the caller’s to widen (join-domain-not-yours): an API key or a service account, a session whose sign-in proved another domain or no email, or one by a way in that doesn’t count for it (GitHub; the workspace’s own provider for a domain the deployment doesn’t route to the workspace). Or this deployment’s operator manages sign-in (join-domains-operator-managed, KINDGI_AUTH_TENANT_PROVIDERS=off): only kindgi:system lets more people in.
object
Examplegenerated
{ "error": { "code": "example", "message": "example", "details": {}, "requestId": "example" }}The operator verified the domain for another workspace (join-domain-verified-elsewhere); the deployment has no authorization store (domain-join-needs-authorization); it’s allowed already (join-domain-exists: change its role instead); or an Idempotency-Key reused with another body. Or idempotency-key-in-flight (with Retry-After): a request with the same Idempotency-Key still runs, so this one wasn’t run; send it again after Retry-After to get that request’s answer.
object
Examplegenerated
{ "error": { "code": "example", "message": "example", "details": {}, "requestId": "example" }}Headers
Section titled “Headers”The request body is over the API’s limit (request-too-large; details.maxBytes says how much).
object
Examplegenerated
{ "error": { "code": "example", "message": "example", "details": {}, "requestId": "example" }}rate-limit-exceeded with details.limit: "api-requests", on a runtime that sets workspace limits (Kindgi Cloud): this workspace’s limit on API requests a minute is reached, so the request wasn’t run; Retry-After says when to send it again.
object
Examplegenerated
{ "error": { "code": "example", "message": "example", "details": {}, "requestId": "example" }}Headers
Section titled “Headers”Server error (unmapped domain code or framework crash).
object
Examplegenerated
{ "error": { "code": "example", "message": "example", "details": {}, "requestId": "example" }}The Idempotency-Key store (idempotency-store-unavailable) or the authorization store (authz-backend-unavailable) couldn’t be reached before the request ran, or the database was too busy for its authorization check (database-busy), so nothing was changed; Retry-After (whole seconds) says when to try again with the same key. Or tenant-state-unavailable (with Retry-After), on a runtime serving many workspaces: the workspace’s state couldn’t be read, so nothing was changed.
object
Examplegenerated
{ "error": { "code": "example", "message": "example", "details": {}, "requestId": "example" }}Headers
Section titled “Headers”See also
GET /v1/auth/join-domains: The email domains people may join the workspace fromPATCH /v1/auth/join-domains/{domain}: Change what someone joining by a domain getsPOST /v1/auth/join-domains/{domain}/unregister: Stop letting people at a domain join- People, API keys and service accounts
- Kindgi 0.7.0
- Error code
authz-backend-unavailable - Error code
bad-input - Error code
database-busy - Error code
domain-join-needs-authorization - Error code
idempotency-key-in-flight - Error code
idempotency-store-unavailable - Error code
join-domain-exists - Error code
join-domain-not-yours - Error code
join-domain-public - Error code
join-domain-verified-elsewhere - Error code
join-domains-operator-managed - Error code
permission-denied - Error code
rate-limit-exceeded - Error code
request-too-large - Error code
tenant-state-unavailable - Every error code