View all methods
auth.whoami
Get contextual information about the authenticated token, including the account, and for personal access tokens, the associated user and team.
Facts
| Method | GET https://api.getdx.com/auth.whoami |
| Required scope | None |
Arguments
Required arguments
| Name | Type | Description |
|---|---|---|
token |
Token |
Auth token passed as an HTTP header. |
Example request
This is a typical request:
curl -sS "https://api.getdx.com/auth.whoami" \
-H "Authorization: Bearer xxxx-xxxxxxxxx-xxxx" \
-H "Accept: application/json"
Example response
This is a typical success response for a personal access token:
{
"ok": true,
"auth_token_type": "personal_access_token",
"account": {
"name": "Example Corporation"
},
"user": {
"id": "MTJ2",
"name": "John Doe",
"email": "john.doe@example.com"
},
"team": {
"id": "NTk3",
"name": "Cool Team",
"lead": {
"id": "MTJ2",
"name": "John Doe",
"email": "john.doe@example.com"
},
"contributors": [
{
"id": "MTJ2",
"name": "John Doe",
"email": "john.doe@example.com"
}
]
}
}
This is a typical success response for an organization token:
{
"ok": true,
"auth_token_type": "account_web_api_token",
"account": {
"name": "Example Corporation"
},
"user": null,
"team": null
}
Response fields
| Field | Type | Description |
|---|---|---|
ok |
Boolean |
Indicates whether the request succeeded. |
auth_token_type |
String |
Type of the authenticated token: personal_access_token or account_web_api_token. |
account |
Object |
The account associated with the token. |
account.name |
String |
Display name of the account. |
user |
Object |
The user associated with the token. null for organization tokens. |
user.id |
String |
ID of the user. |
user.name |
String |
Display name of the user. |
user.email |
String |
Email address of the user. |
team |
Object |
The team the user belongs to. null for organization tokens or users not assigned to a team. |
team.id |
String |
ID of the team. |
team.name |
String |
Display name of the team. |
team.lead |
Object |
The team lead (manager). Same shape as user. |
team.contributors |
Array |
All members of the team. Each element has the same shape as user. |
Errors
This table lists the expected errors that this method could return. However, other errors can be returned in the case where the service is down or other unexpected factors affect processing. Callers should always check the value of the ok param in the response.
| Error | Description |
|---|---|
not_authed |
No authentication token provided. |
invalid_auth |
Some aspect of authentication cannot be validated. |