Register an agent for a person by their email address
Open to any caller; the org comes from the org query parameter.
POST/api/v1/auth/oauth2/agent/identity
- Sign-in
- None at the router: the operation is public, or checks its own proof (a signature, a token in the body, a signed link).
- Rate limit
- Up to 500 requests every 3 seconds per IP address; up to 1,000 requests a minute per API key (some requests are not counted); up to 30 requests a minute per IP address.
Open to any caller; the org comes from the org query parameter. Accepts the auth.md email method (service_auth with login_hint, or identity_assertion with verified_email) and answers a claim token plus a device-style user code and verification link for the person to confirm; the agent then polls the token endpoint with the claim grant. Answers 400 service_auth_not_enabled unless the org has turned on agent registration with a usable agent client, and 400 anonymous_not_enabled or issuer_not_enabled for the other registration methods.
Request
Send the body as application/json or application/x-www-form-urlencoded. The body is optional.
Body
| Field | Type | Required | Constraints | Description |
|---|---|---|---|---|
type | string or number or boolean or null | No | at most 4096 characters | - |
login_hint | string or number or boolean or null | No | at most 4096 characters | - |
assertion_type | string or number or boolean or null | No | at most 4096 characters | - |
assertion | string or number or boolean or null | No | at most 4096 characters | - |
scope | string or number or boolean or null | No | at most 4096 characters | - |
resource | one of: string or number or boolean or null, array of string | No | - | - |
Example request
Replace each YOUR_... value with your own.
curl -X POST "https://api.console.buildbase.app/api/v1/auth/oauth2/agent/identity" \
-H "Content-Type: application/json" \
-d '{
"type": "string",
"login_hint": "string",
"assertion_type": "string"
}'const response = await fetch(
'https://api.console.buildbase.app/api/v1/auth/oauth2/agent/identity',
{
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({
type: 'string',
login_hint: 'string',
assertion_type: 'string',
}),
}
);
if (!response.ok) {
throw new Error(`${response.status}: ${await response.text()}`);
}
const data = await response.json();import requests
response = requests.post(
"https://api.console.buildbase.app/api/v1/auth/oauth2/agent/identity",
json={
"type": "string",
"login_hint": "string",
"assertion_type": "string",
},
timeout=30,
)
response.raise_for_status()
data = response.json()Responses
200 OK
OK
{
"claim": {
"expires_in": 600,
"interval": 5,
"user_code": "[REDACTED]",
"verification_uri": "http://localhost:4103/v1/device?org=000000000000000000000001"
},
"claim_token": "[REDACTED]",
"claim_token_expires": "[REDACTED]",
"claim_url": "http://localhost:3000/api/v1/auth/oauth2/agent/identity/claim?org=000000000000000000000001",
"registration_type": "service_auth"
}Any other status
Any other answer the handler sends itself (its own refusals). Not described yet.
Errors
Each refusal, what it means, and what to do. The request changed nothing.
400 Bad Request
What it means: The request was refused in the OAuth 2.0 error shape (RFC 6749 section 5.2): error is a code such as invalid_request, invalid_grant, unsupported_grant_type or invalid_scope, and error_description says why in words. Branch on error, never on the description.
What to do: Fix the field the body names in path (or read message) and send the request again. Nothing was changed.
{
"error": "string",
"error_description": "string"
}429 Too Many Requests
What it means: A rate limit in x-rateLimit was reached. retryAfter and the Retry-After header say how many seconds until the window resets.
What to do: Wait the number of seconds in the Retry-After header (also retryAfter in the body), then retry. Slow down repeated calls.
{
"success": false,
"message": "string",
"reason": "rate_limited",
"retryAfter": 1
}Related
- OAuth 2.0 guide: how this part of BuildBase works
- All OAuth 2.0 operations
- API reference: every operation, by tag
- Sign-in and credentials for the HTTP API
- How the HTTP API reports errors
- Make your first call
- Error codes: every
codethe API returns - OpenAPI: operation
oauth2.agent.identity.createin public-v1.json