Consumer
A consumer is an account. Every key is created by one, and every call the key makes is attributed to it. This resource reads that account and edits the three fields the API lets it change. There is no endpoint to create or delete a consumer.
Endpoints
| Method | Path | Scope |
|---|---|---|
| GET | /v1/consumer | consumer:read |
| GET | /v1/consumer/<consumer_id> | consumer:read |
| PATCH | /v1/consumer | consumer:write |
<consumer_id> must be your own account, prefixed cons_. Naming any other consumer gives 403 and The API key doesn't have permissions to perform the request.
The consumer object
| Field | Type | Description |
|---|---|---|
id | string | The consumer identifier, prefixed cons_. |
object | string | Always consumer. |
name | string | The first name. |
surname | string | The last name. |
country | string | The country code. |
locale | string | The interface language, as a three-letter ISO 639-3 code. |
email | object | Email address and its verification. See below. |
phone | object | Phone number and its verification. See below. |
security | object | Password and two-factor state. See below. |
activity | object | Login counters. See below. |
status | string | The account's status. |
deleted_at | integer | When the account was deleted, or null. |
created_at | integer | Creation time, in Unix seconds. |
updated_at | integer | Last change, in Unix seconds. |
| Object | Fields |
|---|---|
email | address, is_verified, verified_at |
phone | number, e164, is_verified, verified_at |
security | password_renew, two_factor_enabled, password_updated_at |
activity | login_count, last_login_at |
No password, hash or two-factor secret is ever returned. security reports only whether protections are on and when the password last changed.
Read the consumer
curl https://api.thinkhx.com/v1/consumer \
-H "Authorization: Bearer sk-project-YOUR_KEY" {
"code": 200,
"title": "OK",
"response": {
"id": "cons_8e2b45a10c9df7631b4a",
"object": "consumer",
"name": "Ada",
"surname": "Lovelace",
"country": "us",
"locale": "eng",
"email": {
"address": "ada@acme.example",
"is_verified": true,
"verified_at": 1751331600
},
"phone": {
"number": "+1 415 555 0132",
"e164": "+14155550132",
"is_verified": false,
"verified_at": null
},
"security": {
"password_renew": false,
"two_factor_enabled": true,
"password_updated_at": 1751328000
},
"activity": {
"login_count": 96,
"last_login_at": 1754204400
},
"status": "activated",
"deleted_at": null,
"created_at": 1751328000,
"updated_at": 1754204400
}
} Update the consumer
PATCH /v1/consumer accepts three fields. Send only what you want to change.
| Parameter | Type | Description |
|---|---|---|
name | string | A new first name. |
surname | string | A new last name. |
locale | string | A three-letter ISO 639-3 language code, lowercase. |
curl -X PATCH https://api.thinkhx.com/v1/consumer \
-H "Authorization: Bearer sk-project-YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{ "locale": "fra" }' The response is the complete consumer object, read back after the change.
| Code | Message | Cause |
|---|---|---|
| 400 | No updatable field provided (name, surname, locale). | The body held none of the three. |
| 422 | locale must be a three-letter ISO-639-3 code. | The code was not three lowercase letters. |
Note — Email address, phone number, password and two-factor settings cannot be changed through the API, because each of them needs a verification step. Change them from the workspace.