THINKHX

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

MethodPathScope
GET/v1/consumerconsumer:read
GET/v1/consumer/<consumer_id>consumer:read
PATCH/v1/consumerconsumer: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

FieldTypeDescription
idstringThe consumer identifier, prefixed cons_.
objectstringAlways consumer.
namestringThe first name.
surnamestringThe last name.
countrystringThe country code.
localestringThe interface language, as a three-letter ISO 639-3 code.
emailobjectEmail address and its verification. See below.
phoneobjectPhone number and its verification. See below.
securityobjectPassword and two-factor state. See below.
activityobjectLogin counters. See below.
statusstringThe account's status.
deleted_atintegerWhen the account was deleted, or null.
created_atintegerCreation time, in Unix seconds.
updated_atintegerLast change, in Unix seconds.
ObjectFields
emailaddress, is_verified, verified_at
phonenumber, e164, is_verified, verified_at
securitypassword_renew, two_factor_enabled, password_updated_at
activitylogin_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
curl https://api.thinkhx.com/v1/consumer \
  -H "Authorization: Bearer sk-project-YOUR_KEY"
json
{
  "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.

ParameterTypeDescription
namestringA new first name.
surnamestringA new last name.
localestringA three-letter ISO 639-3 language code, lowercase.
curl
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.

CodeMessageCause
400No updatable field provided (name, surname, locale).The body held none of the three.
422locale 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.

Need help? Contact Support.