RKH

Authentication#

Rokh accepts two types of authentication:

Type Who uses it How
API key Your server The Authorization: Bearer <key> header on each request
Panel session A person in the vendor panel A session cookie after POST /api/vendor/login

Use an API key for all calls from your server. Use the panel session only in the vendor panel.

API keys#

An API key starts with rk_live_. Rokh shows the full key one time only, when you make it. Rokh keeps only a hash of the key. If you lose a key, make a new key and revoke the old key.

An API key acts as your vendor account. It can do all the operations of the vendor API, with these exceptions:

For these operations, sign in to the vendor panel.

Make an API key#

  1. Sign in to the vendor panel at https://rokh.id/vendor.
  2. Open Developers.
  3. In API keys, type a name for the key. Use the name of the server that uses the key.
  4. Click Make a key.
  5. Copy the key. Put it in the secret store of your server.

You can also make a key with the API, from a panel session:

POST /api/vendor/panel/api-keys
Content-Type: application/json

{"label": "payments server"}

The response has the status 201 and the key in api_key.secret:

{"api_key": {"id": "6f1c…", "label": "payments server", "prefix": "rk_live_PPYM",
             "created_at": "2026-10-12T08:30:00+00:00", "last_used_at": null, "revoked_at": null,
             "active": true, "secret": "rk_live_PPYM…"}}

Use an API key#

Send the key in the Authorization header of each request:

curl https://rokh.id/api/vendor/requests -H "Authorization: Bearer $ROKH_API_KEY"

When a request has an Authorization header, Rokh uses only that header. Rokh does not use a session cookie on the same request. A wrong, revoked or incorrect key always gives the status 401.

See your keys#

GET /api/vendor/panel/api-keys gives the list of your keys. The list shows the name, the first 12 characters (prefix), the date of the last use and the status of each key. The list never shows a full key.

Rokh records the time of the last use. It updates this time at most one time each minute.

Revoke an API key#

  1. Sign in to the vendor panel.
  2. Open Developers.
  3. In API keys, find the key. Click Revoke.

You can also send DELETE /api/vendor/panel/api-keys/{key_id} from a panel session. Rokh refuses the key immediately. You cannot make a revoked key active again.

Warning: If a person who must not have a key knows the key, revoke the key immediately. Then make a new key.

Security rules#

Panel session#

The vendor panel uses a session cookie. Do not use the panel session from your server.

Endpoint Body Result
POST /api/vendor/login {"username": "…", "password": "…"} Sets the session cookie
POST /api/vendor/logout none Ends the session
GET /api/vendor/session none {"authenticated": true, "vendor": {…}} or {"authenticated": false, "vendor": null}

Rokh limits the number of sign-in attempts from one address. Too many attempts give the status 429 for a short time.

Errors of authentication#

Status Cause What to do
401 No key, a wrong key, a revoked key or a disabled vendor account Examine the key. Make a new key if necessary.
403 An API key on an operation that needs the panel session Sign in to the panel for this operation.
404 The request belongs to a different vendor Use the key of the vendor that made the request.

Rokh vendor API. The text follows ASD-STE100 Simplified Technical English.