The signed-in principal
The caller’s own profile, sign-in identities, and sessions. Of these, a delegated token reaches only GET /me and sign-out: a delegate acting for a principal never reaches the principal’s account. Elsewhere it acts within its delegation, such as in POST /access/check and GET /access/permissions.
Sessions explains how long a session lasts and what ends it, and Principals what a principal is.
Paths are relative to https://api.agentpost.tools/v1/identity, and every request follows the API basics. Who may call explains each kind of caller.
Get the signed-in principal
GET /me
The signed-in principal.
- Who may call: A signed-in principal.
- Credential: the examples send a signed-in principal’s session token,
agp_st_…, asAuthorization: Bearer <token>. - SDK:
client.me.get()
Response
200 OK, with:
| Name | Type | Present | Description |
|---|---|---|---|
principal |
Principal |
Always |
Errors
Any operation can also answer with the codes Conventions lists.
Update the signed-in principal
PATCH /me
Changes the display name, avatar, metadata, or declared kind.
- Who may call: A signed-in principal.
- Credential: the examples send a signed-in principal’s session token,
agp_st_…, asAuthorization: Bearer <token>. - SDK:
client.me.patch(patch) - Idempotency-Key: optional. Retrying a write has the rule.
Body
| Name | Type | Required | Description |
|---|---|---|---|
kind |
string or null |
No | One of "human", "agent", or "service". |
displayName |
string or null |
No | A supplied name, 1 to 120 characters. Send null to clear it. |
avatarUrl |
string or null |
No | |
metadata |
object |
No |
Response
200 OK, with:
| Name | Type | Present | Description |
|---|---|---|---|
principal |
Principal |
Always |
Errors
Any operation can also answer with the codes Conventions lists.
List sign-in identities
GET /me/identities
The sign-in identities linked to the caller.
- Who may call: A signed-in principal.
- Credential: the examples send a signed-in principal’s session token,
agp_st_…, asAuthorization: Bearer <token>. - SDK:
client.me.identities()
Response
200 OK, with:
| Name | Type | Present | Description |
|---|---|---|---|
identities |
Identity array |
Always |
Errors
forbidden(403)
Any operation can also answer with the codes Conventions lists.
Send a code to add an email
POST /me/identities/email
Sends a code to an email address the caller wants to add.
- Who may call: A signed-in principal.
- Credential: the examples send a signed-in principal’s session token,
agp_st_…, asAuthorization: Bearer <token>. - SDK:
client.me.requestEmailCode(input) - Idempotency-Key: optional. Retrying a write has the rule.
Body
| Name | Type | Required | Description |
|---|---|---|---|
email |
string |
Yes | An email address; up to 254 characters. |
Response
202 Accepted, with CodeRequested.
Errors
forbidden(403)not_found(404)sign_in_disabled(403)throttled(429)
Any operation can also answer with the codes Conventions lists.
Verify an added email
POST /me/identities/email/verify
Checks the code and links the email address as an identity.
- Who may call: A signed-in principal.
- Credential: the examples send a signed-in principal’s session token,
agp_st_…, asAuthorization: Bearer <token>. - SDK:
client.me.verifyEmailCode(input) - Idempotency-Key: optional. Retrying a write has the rule.
Body
| Name | Type | Required | Description |
|---|---|---|---|
email |
string |
Yes | An email address; up to 254 characters. |
code |
string |
Yes | The 6-digit code from the email. |
verificationId |
string |
Yes | The verificationId the code request returned. |
Response
201 Created, with:
| Name | Type | Present | Description |
|---|---|---|---|
identity |
Identity |
Always |
Errors
code_expired(400)code_invalid(400)forbidden(403)identity_in_use(409)throttled(429)
Any operation can also answer with the codes Conventions lists.
Remove a sign-in identity
DELETE /me/identities/:id
Unlinks a sign-in identity when the principal has another way to sign in. Sessions started with the removed identity end.
- Who may call: A signed-in principal.
- Credential: the examples send a signed-in principal’s session token,
agp_st_…, asAuthorization: Bearer <token>. - SDK:
client.me.removeIdentity(id) - Idempotency-Key: optional. Retrying a write has the rule.
Path parameters
| Name | Type | Required | Description |
|---|---|---|---|
id |
string |
Yes | An identity ID, idn_…. The id of a Identity. |
Response
204 No Content, with no body.
Errors
forbidden(403)last_sign_in_method(409)not_found(404)
Any operation can also answer with the codes Conventions lists.
List sessions
GET /me/sessions
The caller’s live sessions.
- Who may call: A signed-in principal.
- Credential: the examples send a signed-in principal’s session token,
agp_st_…, asAuthorization: Bearer <token>. - SDK:
client.me.sessions()
Response
200 OK, with:
| Name | Type | Present | Description |
|---|---|---|---|
sessions |
Session array |
Always |
Errors
forbidden(403)
Any operation can also answer with the codes Conventions lists.
End a session
DELETE /me/sessions/:id
Ends one of the caller’s sessions.
- Who may call: A signed-in principal.
- Credential: the examples send a signed-in principal’s session token,
agp_st_…, asAuthorization: Bearer <token>. - SDK:
client.me.revokeSession(id) - Idempotency-Key: optional. Retrying a write has the rule.
Path parameters
| Name | Type | Required | Description |
|---|---|---|---|
id |
string |
Yes | A session ID, ses_…. The id of a Session. |
Response
204 No Content, with no body.
Errors
Any operation can also answer with the codes Conventions lists.
End other sessions
DELETE /me/sessions
Ends every session but the one the call is made with.
- Who may call: A signed-in principal.
- Credential: the examples send a signed-in principal’s session token,
agp_st_…, asAuthorization: Bearer <token>. - SDK:
client.me.revokeOtherSessions() - Idempotency-Key: optional. Retrying a write has the rule.
Response
200 OK, with:
| Name | Type | Present | Description |
|---|---|---|---|
revoked |
number |
Always |
Errors
forbidden(403)
Any operation can also answer with the codes Conventions lists.
Merge a guest
POST /me/merge-guest
Moves a guest’s grants and resource roles to the signed-in principal, with the guest’s session token as proof, then deletes the guest. A role on a resource both hold in different workspaces answers merge_blocked.
- Who may call: A signed-in principal.
- Credential: the examples send a signed-in principal’s session token,
agp_st_…, asAuthorization: Bearer <token>. - SDK:
client.me.mergeGuest(input) - Idempotency-Key: optional. Retrying a write has the rule.
Body
| Name | Type | Required | Description |
|---|---|---|---|
guestSessionToken |
string |
Yes | 16–512 characters. |
Response
200 OK, with MergeGuestResponse.
Errors
conflict(409)forbidden(403)merge_blocked(409)not_found(404)
Any operation can also answer with the codes Conventions lists.
Merge another account
POST /me/merge
Merges another principal’s account into the signed-in principal’s, with the merge ticket that linking one of its sign-in methods returned. Its sign-in identities, connected accounts, grants, resource roles, project roles, and workspace memberships move over; where both are in one workspace, an active membership stays over a suspended one, then an owner one over any other role, and otherwise the signed-in principal’s stays. The other account’s sessions end, and it stays with mergedInto set, so its ID still resolves. Needs accounts.merge: on.
- Who may call: A signed-in principal.
- Access: Only the signed-in principal the ticket was issued to, while both accounts are active principals.
- Credential: the examples send a signed-in principal’s session token,
agp_st_…, asAuthorization: Bearer <token>. - SDK:
client.me.merge(input) - Idempotency-Key: optional. Retrying a write has the rule.
Body
| Name | Type | Required | Description |
|---|---|---|---|
mergeTicket |
string |
Yes | The details.mergeTicket from the identity_in_use error a link returned; 16–512 characters. |
Response
200 OK, with MergeAccountResponse.
Errors
conflict(409)forbidden(403)merge_blocked(409)not_found(404)
Any operation can also answer with the codes Conventions lists.
The Identity object
| Name | Type | Present | Description |
|---|---|---|---|
id |
string |
Always | An identity ID, idn_…. |
principalId |
string |
Always | A principal ID, prn_…. |
type |
"email" or "oauth" |
Always | |
provider |
"email" or "twitch" |
Always | |
subject |
string |
Always | |
verifiedAt |
string |
Always | An ISO 8601 date and time. |
profile |
object |
When set | |
profile. |
string |
When set | |
profile. |
string |
When set | |
profile. |
string |
When set | |
profile. |
string |
When set | |
createdAt |
string |
Always | An ISO 8601 date and time. |
lastUsedAt |
string |
When set | An ISO 8601 date and time. |
The MergeGuestResponse object
What a merge answers with: the principal as it stands, the guest’s ID, and what moved over.
| Name | Type | Present | Description |
|---|---|---|---|
principal |
Principal |
Always | |
guestId |
string |
Always | A principal ID, prn_…. |
moved |
object |
Always | |
moved. |
number |
Always | |
moved. |
number |
Always |
The MergeAccountResponse object
What POST /me/merge answers with: the principal as it stands, the merged account’s ID, and how much of each kind moved over.
| Name | Type | Present | Description |
|---|---|---|---|
principal |
Principal |
Always | |
mergedId |
string |
Always | A principal ID, prn_…. |
moved |
object |
Always | |
moved. |
number |
Always | |
moved. |
number |
Always | |
moved. |
number |
Always | |
moved. |
number |
Always | |
moved. |
number |
Always | |
moved. |
number |
Always |