Skip to main content

Unpacking context_id

context_id is a required field when querying information about an address. It plays a pivotal role in ensuring data is correctly associated with the specific instance of your application.

This approach allows you to segment and analyze bot interactions on a per-instance basis.

tip

Questing platforms usually create a new context_id for each quest.

Under The Hood​

Each identification looks if the user has ever been a bot for that context_id.

An address controlled for a human for one quest might be a bot for another. Therefore, our system allows you to separate the personhood check for different actions.

Key Points​

  • Assign a unique context_id to each instance or environment of your application.
  • Always include the relevant context_id in your API requests to Absinthe Protect.

What You Will Need​

  1. API Key: string
    • To authorize the registration and tie the id with your key
  2. context_title: string
    • This value will be part of the context_id and helps give it a memorable name.

Endpoint Description​

Endpoint: api/v1/register/context_id

Method: POST

Description: This endpoint allows you to register a context_id when given a context_title and ties it to your API key.

Request URL
https://absinthe-prod-aj5ib4l2.ue.gateway.dev/api/v1/register/context_id

Query Parameters​

  • eoa_address: The account address you want to query for bot-status.
  • context_id: The unique identifier for your application context.

Headers​

x-api-key: Your API Key.

Request Body​

context_title: The title or name of the context you wish to register.

Success Response​

Code: 200 OK

content
{"success":true,"data":{"context_id":"sample_context_id.54b8c3b00e05"}

Error Response​

content
{"success":false,"error":{"id":"m_a_b_1","code":"UNAUTHORIZED","message":"Bad API key or contextId."}}

Examples​

curl
curl --location 'https://absinthe-prod-aj5ib4l2.ue.gateway.dev/api/v1/register/context_id' \
--header 'x-api-key: <my_api_key>' \
--header 'Content-Type: application/json' \
--data '{
"context_title": "<sample_context_title>"
}'

Or in node.js:

node.js
var myHeaders = new Headers();
myHeaders.append("x-api-key", "bHvAiwk7hUj0");
myHeaders.append("Content-Type", "application/json");

var raw = JSON.stringify({
"context_title": "sampleid2"
});

var requestOptions = {
method: 'POST',
headers: myHeaders,
body: raw,
redirect: 'follow'
};

fetch("https://absinthe-prod-aj5ib4l2.ue.gateway.dev/api/v1/register/context_id", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));