Ledger

List of Ledger Configurations

get
GET tokens/ledger-configurations/list

Returns the list of ledgers for the associated Bearer. This request will include the ledger hash which is required for token generation

Header

Header Type Required Description
Header: Authorization Type: String Required: Yes Description:

Bearer {{YOUR_API_ACCESS_TOKEN}}

Response Fields (Success 200)

Field Type Description
Field: name Type: String Description:

The Name of the ledger

Field: description Type: String Description:

The description of the ledger

Field: hash Type: String Description:

The unique hash of the ledger used for future API interactions

Error Fields (Error 401)

Field Type Description
Field: message Type: String Description:

"Unauthenticated".

Error Fields (Error 403)

Field Type Description
Field: message Type: String Description:

"This action is unauthorised".

Send a Sample Request

GET

Header

Code Examples

curl https://api.aql.com/tokens/ledger-configurations/list \
-X GET \
-H "Content-type: application/json" \
-H "Authorization: Bearer {{YOUR_API_ACCESS_TOKEN}}"
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, "https://api.aql.com/tokens/ledger-configurations/list");
curl_setopt($curl, CURLOPT_HTTPHEADER, ["Authorization: Bearer {{YOUR_API_ACCESS_TOKEN}}", "Content-type: application/json"]);
$response = curl_exec($curl);
curl_close($curl);
import requests

url = "https://api.aql.com/tokens/ledger-configurations/list"

headers = {
'Authorization': "Bearer {{YOUR_API_ACCESS_TOKEN}}",
'content-type': "application/json"
}

response = requests.get(url, headers=headers)

print(response.text)
var client = new RestClient("https://api.aql.com/tokens/ledger-configurations/list");
var request = new RestRequest(Method.GET);
request.AddHeader("content-type", "application/json");
request.AddHeader("Authorization", "Bearer {{YOUR_API_ACCESS_TOKEN}}");
IRestResponse response = client.Execute(request);
use REST::Client;
use JSON;
use Data::Dumper;

my $endpoint = 'tokens/ledger-configurations/list';

my $client = REST::Client->new();
$client->addHeader('Content-Type' => 'application/json');
$client->addHeader('Authorization' => 'Bearer {{YOUR_API_ACCESS_TOKEN}}');
$client->setHost('https://api.aql.com/');
$client->GET($endpoint);
my $response = from_json($client->responseContent());
print Dumper($response);

Success Response Example

HTTP/1.1 200 OK
{
"success": true,
"data": [
{
"name": "Ledger Configuration1",
"description": "Configuration Description1",
"hash": "{HASH}"
},
{
"name": "Ledger Configuration2",
"description": "Configuration Description 2",
"hash": "{HASH}"
}
],
"message": "Ledger configuration list."
}

Error Response Example

401-Error-Response:

HTTP/1.1 401 Unauthorised
{
"message": "Unauthenticated."
}

403-Error-Response:

HTTP/1.1 403 Forbidden
{
"message": "This action is unauthorised."
}

Ledger History

get
GET tokens/ledger/:token

Provides the ledger history for the supplied token

Header

Header Type Required Description
Header: Authorization Type: String Required: Yes Description:

Bearer {{YOUR_API_ACCESS_TOKEN}}

Parameter

Parameter Type Required Description
Parameter: token Type: String Required: Yes Description:

The token to be requested from the ledger

Parameter: private_token Type: String Required: No Description:

The private token for the ledger, required if the ledger mandates the use of a private key

Response Fields (Success 200)

Field Type Description
Field: data Type: Object Description:

The ledger history for the requested token

Error Fields (Error 401)

Field Type Description
Field: message Type: String Description:

"Unauthenticated".

Error Fields (Error 403)

Field Type Description
Field: message Type: String Description:

"This action is unauthorised".

Send a Sample Request

GET

Header

Parameter

Code Examples

curl https://api.aql.com/tokens/ledger/:token \
-X GET \
-H "Content-type: application/json" \
-H "Authorization: Bearer {{YOUR_API_ACCESS_TOKEN}}"
$curl = curl_init();

curl_setopt($curl, CURLOPT_URL, "https://api.aql.com/tokens/ledger/:token");
curl_setopt($curl, CURLOPT_HTTPHEADER, ["Authorization: Bearer {{YOUR_API_ACCESS_TOKEN}}", "Content-type: application/json"]);
$response = curl_exec($curl);
curl_close($curl);
import requests

url = "https://api.aql.com/tokens/ledger/:token"

headers = {
'Authorization': "Bearer {{YOUR_API_ACCESS_TOKEN}}",
'content-type': "application/json"
}

response = requests.get(url, headers=headers)

print(response.text)
var client = new RestClient("https://api.aql.com/tokens/ledger/:token");
var request = new RestRequest(Method.GET);
request.AddHeader("content-type", "application/json");
request.AddHeader("Authorization", "Bearer {{YOUR_API_ACCESS_TOKEN}}");
IRestResponse response = client.Execute(request);
use REST::Client;
use JSON;
use Data::Dumper;

my $endpoint = 'tokens/ledger/:token';

my $client = REST::Client->new();
$client->addHeader('Content-Type' => 'application/json');
$client->addHeader('Authorization' => 'Bearer {{YOUR_API_ACCESS_TOKEN}}');
$client->setHost('https://api.aql.com/');
$client->GET($endpoint);
my $response = from_json($client->responseContent());
print Dumper($response);

Success Response Example

HTTP/1.1 200 OK
{
"data": [
{
"token": "token",
"ledgerConfigurationHash": "ledger-hash",
"action": "Token generated",
"attributes": {
"name": "ledger-name",
"description": "ledger-description",
"type": "SHA 512",
"claim_amount": 1,
"valid_from": "06-02-2023 15:23:14"
},
"metadata": {
"ID": "Asset1",
"Location": "1"
},
"private_metadata": "private-metadata",
"document": "ledger-block",
"created_at": "2023-02-06T15:23:15.000000Z"
}
],
"message": "LedgerRecords"
}

Error Response Example

401-Error-Response:

HTTP/1.1 401 Unauthorised
{
"message": "Unauthenticated."
}

403-Error-Response:

HTTP/1.1 403 Forbidden
{
"message": "This action is unauthorised."
}

422-Error-Response:

HTTP/1.1 422 Unprocessable Entity
{
"message": "The given token was invalid.",
"errors": {
"token": [
"The token field is required."
]
}
}

Tokens

Append additional token metadata

post
POST tokens/append/:token/meta

Submits a job to append additional json metadata to the specified token

Header

Header Type Required Description
Header: Authorization Type: String Required: Yes Description:

Bearer {{YOUR_API_ACCESS_TOKEN}}

Parameter

Parameter Type Required Description
Parameter: token Type: String Required: Yes Description:

The token to be validated

Parameter: metadata Type: Object Required: No Description:

The additional json metadata required to be stored against the token

Response Fields (Success 200)

Field Type Description
Field: jobid Type: String Description:

Returns the unique jobId to track the addition of the metadata

Error Fields (Error 401)

Field Type Description
Field: message Type: String Description:

"Unauthenticated".

Error Fields (Error 403)

Field Type Description
Field: message Type: String Description:

"This action is unauthorised".

Send a Sample Request

POST

Header

Parameter

Code Examples

curl https://api.aql.com/tokens/append/:token/meta \
-X POST \
-H "Content-type: application/json" \
-H "Authorization: Bearer {{YOUR_API_ACCESS_TOKEN}}" \
-d '{"metadata": "{}"}'
$curl = curl_init();
$data = ["metadata" => "{}"];
curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_URL, "https://api.aql.com/tokens/append/:token/meta");
curl_setopt($curl, CURLOPT_HTTPHEADER, ["Authorization: Bearer {{YOUR_API_ACCESS_TOKEN}}", "Content-type: application/json"]);
curl_setopt($curl, CURLOPT_POSTFIELDS, json_encode($data));
$response = curl_exec($curl);
curl_close($curl);
import requests

url = "https://api.aql.com/tokens/append/:token/meta"
payload = {"metadata": "{}"}

headers = {
'Authorization': "Bearer {{YOUR_API_ACCESS_TOKEN}}",
'content-type': "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
var client = new RestClient("https://api.aql.com/tokens/append/:token/meta");
var request = new RestRequest(Method.POST);
request.AddHeader("content-type", "application/json");
request.AddHeader("Authorization", "Bearer {{YOUR_API_ACCESS_TOKEN}}");
request.AddParameter("application/json", "{\"metadata\": \"{}\"}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
use REST::Client;
use JSON;
use Data::Dumper;

my $endpoint = 'tokens/append/:token/meta';
my $data = {metadata => "{}"};

my $client = REST::Client->new();
$client->addHeader('Content-Type' => 'application/json');
$client->addHeader('Authorization' => 'Bearer {{YOUR_API_ACCESS_TOKEN}}');
$client->setHost('https://api.aql.com/');
$client->POST($endpoint, encode_json($data));
my $response = from_json($client->responseContent());
print Dumper($response);

Success Response Example

HTTP/1.1 201 OK
{
"data": {
"jobId": "jobId"
},
"message": "Token metadata append submitted for processing"
}

Error Response Example

401-Error-Response:

HTTP/1.1 401 Unauthorised
{
"message": "Unauthenticated."
}

403-Error-Response:

HTTP/1.1 403 Forbidden
{
"message": "This action is unauthorised."
}

422-Error-Response:

HTTP/1.1 422 Unprocessable Entity
{
"message": "The given token was invalid.",
"errors": {
"token": [
"The token field is required."
]
}
}

Token Claim

post
POST tokens/claim

Submits a job to claim the supplied token(s), the claim result will be invoked to the supplied subscription callback handler.

Header

Header Type Required Description
Header: Authorization Type: String Required: Yes Description:

Bearer {{YOUR_API_ACCESS_TOKEN}}

Parameter

Parameter Type Required Description
Parameter: token Type: String Required: Yes Description:

The token to be validated

Parameter: tokens Type: Array Required: No Description:

Token array to support multiple token(s)

Parameter: private_token Type: String Required: No Description:

The private token for the subscription, required if the subscription mandates the use of a private key

Response Fields (Success 200)

Field Type Description
Field: jobid Type: String Description:

Returns the unique jobId's to track the claiming process for the supplied tokens

Error Fields (Error 401)

Field Type Description
Field: message Type: String Description:

"Unauthenticated".

Error Fields (Error 403)

Field Type Description
Field: message Type: String Description:

"This action is unauthorised".

Send a Sample Request

POST

Header

Parameter

Code Examples

curl https://api.aql.com/tokens/claim \
-X POST \
-H "Content-type: application/json" \
-H "Authorization: Bearer {{YOUR_API_ACCESS_TOKEN}}" \
-d '{"token" : "{{YOUR_TRUSTI_TOKEN}}"}'
$curl = curl_init();
$data = ["token" => "{{YOUR_TRUSTI_TOKEN}}"];
curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_URL, "https://api.aql.com/tokens/claim");
curl_setopt($curl, CURLOPT_HTTPHEADER, ["Authorization: Bearer {{YOUR_API_ACCESS_TOKEN}}", "Content-type: application/json"]);
curl_setopt($curl, CURLOPT_POSTFIELDS, json_encode($data));
$response = curl_exec($curl);
curl_close($curl);
import requests

url = "https://api.aql.com/tokens/claim"
payload = {"token": "{{YOUR_TRUSTI_TOKEN}}"}

headers = {
'Authorization': "Bearer {{YOUR_API_ACCESS_TOKEN}}",
'content-type': "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
var client = new RestClient("https://api.aql.com/tokens/claim");
var request = new RestRequest(Method.POST);
request.AddHeader("content-type", "application/json");
request.AddHeader("Authorization", "Bearer {{YOUR_API_ACCESS_TOKEN}}");
request.AddParameter("application/json", "{\"token\" : \"{{YOUR_TRUSTI_TOKEN}}\"}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
use REST::Client;
use JSON;
use Data::Dumper;

my $endpoint = 'tokens/claim';
my $data = {token => "{{YOUR_TRUSTI_TOKEN}}"};

my $client = REST::Client->new();
$client->addHeader('Content-Type' => 'application/json');
$client->addHeader('Authorization' => 'Bearer {{YOUR_API_ACCESS_TOKEN}}');
$client->setHost('https://api.aql.com/');
$client->POST($endpoint, encode_json($data));
my $response = from_json($client->responseContent());
print Dumper($response);

Success Response Example

HTTP/1.1 200 OK
{
"data": [
{
"jobId": "token-jobId"
}
],
"message": "Token claim submitted for processing"
}

Error Response Example

401-Error-Response:

HTTP/1.1 401 Unauthorised
{
"message": "Unauthenticated."
}

403-Error-Response:

HTTP/1.1 403 Forbidden
{
"message": "This action is unauthorised."
}

422-Error-Response:

HTTP/1.1 422 Unprocessable Entity
{
"message": "The given token was invalid.",
"errors": {
"token": [
"The token field is required."
]
}
}

Token Generation

post
POST tokens/ledgers/:ledgerId/generate

Submits token generation request as per the specified ledger. Optional public metadata, private metadata, and redirect options can be supplied.

Header

Header Type Required Description
Header: Authorization Type: String Required: Yes Description:

Bearer {{YOUR_API_ACCESS_TOKEN}}

Parameter

Parameter Type Required Description
Parameter: ledgerId Type: String Required: Yes Description:

The ledger which the token is being generated against

Parameter: metadata Type: Object Required: No Description:

If the ledger supports the storage of metaData the supplied key/value pairs will be stored with the token

Parameter: private_metadata Type: Object Required: No Description:

Unique attributes used to associate the token with the associated real work asset, this data is encrypted within the trusti token

Parameter: csr Type: String Required: No Description:

An optional Certificate signing request can be provided, if supplied this will be used for the certification generation

Parameter: redirect_url Type: String Required: No Description:

An optional URL to redirect the user to when token is validated

Parameter: redirect_meta Type: Object Required: No Description:

Optional JSON metadata to be passed along with the redirect

Response Fields (Success 200)

Field Type Description
Field: string Type: String Description:

Returns the unique jobId to track the creation of the requested token

Error Fields (Error 401)

Field Type Description
Field: message Type: String Description:

"Unauthenticated".

Error Fields (Error 403)

Field Type Description
Field: message Type: String Description:

"This action is unauthorised".

Send a Sample Request

POST

Header

Parameter

Code Examples

curl https://api.aql.com/tokens/ledgers/:ledgerId/generate \
-X POST \
-H "Content-type: application/json" \
-H "Authorization: Bearer {{YOUR_API_ACCESS_TOKEN}}"
$curl = curl_init();
curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_URL, "https://api.aql.com/tokens/ledgers/:ledgerId/generate");
curl_setopt($curl, CURLOPT_HTTPHEADER, ["Authorization: Bearer {{YOUR_API_ACCESS_TOKEN}}", "Content-type: application/json"]);
$response = curl_exec($curl);
curl_close($curl);
import requests

url = "https://api.aql.com/tokens/ledgers/:ledgerId/generate"

headers = {
'Authorization': "Bearer {{YOUR_API_ACCESS_TOKEN}}",
'content-type': "application/json"
}

# Add 'json={...}' here if sending metadata
response = requests.post(url, headers=headers)

print(response.text)
var client = new RestClient("https://api.aql.com/tokens/ledgers/:ledgerId/generate");
var request = new RestRequest(Method.POST);
request.AddHeader("content-type", "application/json");
request.AddHeader("Authorization", "Bearer {{YOUR_API_ACCESS_TOKEN}}");
IRestResponse response = client.Execute(request);
use REST::Client;
use JSON;
use Data::Dumper;

my $endpoint = 'tokens/ledgers/:ledgerId/generate';

my $client = REST::Client->new();
$client->addHeader('Content-Type' => 'application/json');
$client->addHeader('Authorization' => 'Bearer {{YOUR_API_ACCESS_TOKEN}}');
$client->setHost('https://api.aql.com/');
$client->POST($endpoint);
my $response = from_json($client->responseContent());
print Dumper($response);

Success Response Example

HTTP/1.1 201 OK
{
"data":{
"tokenJobId": "token-jobId"
},
"message": "success"
}

Error Response Example

401-Error-Response:

HTTP/1.1 401 Unauthorised
{
"message": "Unauthenticated."
}

403-Error-Response:

HTTP/1.1 403 Forbidden
{
"message": "This action is unauthorised."
}

Token Validation

post
POST tokens/validate

Validates the supplied token(s) to confirm their current status. The response will return the current claim status and validity of the supplied token(s)

Header

Header Type Required Description
Header: Authorization Type: String Required: Yes Description:

Bearer {{YOUR_API_ACCESS_TOKEN}}

Parameter

Parameter Type Required Description
Parameter: token Type: String Required: Yes Description:

The token to be validated

Parameter: tokens Type: Array Required: No Description:

Token array to support multiple token(s)

Parameter: private_token Type: String Required: No Description:

The private token for the subscription, required if the subscription mandates the use of a private key

Parameter: private_metadata Type: Object Required: No Description:

Unique attributes used to associate the token with the associated real work asset, this data is encrypted within the trusti token. Can be supplied for revalidation

Response Fields (Success 200)

Field Type Description
Field: data Type: Object Description:

Returns the validity of the token, including the expiry period and the number of remaining claims

Error Fields (Error 401)

Field Type Description
Field: message Type: String Description:

"Unauthenticated".

Error Fields (Error 403)

Field Type Description
Field: message Type: String Description:

"This action is unauthorised".

Send a Sample Request

POST

Header

Parameter

Code Examples

curl https://api.aql.com/tokens/validate \
-X POST \
-H "Content-type: application/json" \
-H "Authorization: Bearer {{YOUR_API_ACCESS_TOKEN}}" \
-d '{"token" : "{{YOUR_TRUSTI_TOKEN}}"}'
$curl = curl_init();
$data = ["token" => "{{YOUR_TRUSTI_TOKEN}}"];
curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_URL, "https://api.aql.com/tokens/validate");
curl_setopt($curl, CURLOPT_HTTPHEADER, ["Authorization: Bearer {{YOUR_API_ACCESS_TOKEN}}", "Content-type: application/json"]);
curl_setopt($curl, CURLOPT_POSTFIELDS, json_encode($data));
$response = curl_exec($curl);
curl_close($curl);
import requests

url = "https://api.aql.com/tokens/validate"
payload = {"token": "{{YOUR_TRUSTI_TOKEN}}"}

headers = {
'Authorization': "Bearer {{YOUR_API_ACCESS_TOKEN}}",
'content-type': "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
var client = new RestClient("https://api.aql.com/tokens/validate");
var request = new RestRequest(Method.POST);
request.AddHeader("content-type", "application/json");
request.AddHeader("Authorization", "Bearer {{YOUR_API_ACCESS_TOKEN}}");
request.AddParameter("application/json", "{\"token\" : \"{{YOUR_TRUSTI_TOKEN}}\"}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
use REST::Client;
use JSON;
use Data::Dumper;

my $endpoint = 'tokens/validate';
my $data = {token => "{{YOUR_TRUSTI_TOKEN}}"};

my $client = REST::Client->new();
$client->addHeader('Content-Type' => 'application/json');
$client->addHeader('Authorization' => 'Bearer {{YOUR_API_ACCESS_TOKEN}}');
$client->setHost('https://api.aql.com/');
$client->POST($endpoint, encode_json($data));
my $response = from_json($client->responseContent());
print Dumper($response);

Success Response Example

HTTP/1.1 200 OK
{
"data": [
{
"token": "token",
"certificate": "certificate",
"claimsRemaining": 1,
"ledger": [
{
"token": "token",
"ledgerConfigurationHash": "ledger-hash",
"action": "Token generated",
"attributes": {
"name": "ledger-name",
"description": "ledger-description",
"type": "Sha 256",
"claim_amount": 1,
"valid_from": "06-02-2023 15:23:14"
},
"metadata": {
"ID": "Asset1",
"Location": "1"
},
"private_metadata": "private-metadata",
"document": "ledger-block",
"created_at": "2023-02-06T15:23:15.000000Z"
}
],
"message": "Token is valid"
}
],
"message": "Token validation successful"
}

Error Response Example

401-Error-Response:

HTTP/1.1 401 Unauthorised
{
"message": "Unauthenticated."
}

403-Error-Response:

HTTP/1.1 403 Forbidden
{
"message": "This action is unauthorised."
}

422-Error-Response:

HTTP/1.1 422 Unprocessable Entity
{
"message": "The given token was invalid.",
"errors": {
"token": [
"The token field is required."
]
}
}

Token Job Status

get
GET tokens/job/:jobId/status

Returns the status of a token job, if the job has been completed the token details will be returned

Header

Header Type Required Description
Header: Authorization Type: String Required: Yes Description:

Bearer {{YOUR_API_ACCESS_TOKEN}}

Parameter

Parameter Type Required Description
Parameter: jobId Type: String Required: Yes Description:

The jobId to be checked

Response Fields (Success 200)

Field Type Description
Field: data Type: Object Description:

Returns the job status if the job hasn't completed. If the job has completed the token details will be returned.

Error Fields (Error 401)

Field Type Description
Field: message Type: String Description:

"Unauthenticated".

Error Fields (Error 403)

Field Type Description
Field: message Type: String Description:

"This action is unauthorised".

Error Fields (Error 404)

Field Type Description
Field: . Type: String Description:

Send a Sample Request

GET

Header

Parameter

Code Examples

curl https://api.aql.com/tokens/job/:jobId/status \
-X GET \
-H "Content-type: application/json" \
-H "Authorization: Bearer {{YOUR_API_ACCESS_TOKEN}}"
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, "https://api.aql.com/tokens/job/:jobId/status");
curl_setopt($curl, CURLOPT_HTTPHEADER, ["Authorization: Bearer {{YOUR_API_ACCESS_TOKEN}}", "Content-type: application/json"]);
$response = curl_exec($curl);
curl_close($curl);
import requests

url = "https://api.aql.com/tokens/job/:jobId/status"

headers = {
'Authorization': "Bearer {{YOUR_API_ACCESS_TOKEN}}",
'content-type': "application/json"
}

response = requests.get(url, headers=headers)

print(response.text)
var client = new RestClient("https://api.aql.com/tokens/job/:jobId/status");
var request = new RestRequest(Method.GET);
request.AddHeader("content-type", "application/json");
request.AddHeader("Authorization", "Bearer {{YOUR_API_ACCESS_TOKEN}}");
IRestResponse response = client.Execute(request);
use REST::Client;
use JSON;
use Data::Dumper;

my $endpoint = 'tokens/job/:jobId/status';

my $client = REST::Client->new();
$client->addHeader('Content-Type' => 'application/json');
$client->addHeader('Authorization' => 'Bearer {{YOUR_API_ACCESS_TOKEN}}');
$client->setHost('https://api.aql.com/');
$client->GET($endpoint);
my $response = from_json($client->responseContent());
print Dumper($response);

Success Response Example

HTTP/1.1 200 OK
{
"data": {
... job status details
}
}

Error Response Example

401-Error-Response:

HTTP/1.1 401 Unauthorised
{
"message": "Unauthenticated."
}

403-Error-Response:

HTTP/1.1 403 Forbidden
{
"message": "This action is unauthorised."
}

404-Error-Response:

HTTP/1.1 404 Not Found
AutoJemma®

How can I help you today?

Can't find what you're looking for, ask a question below!

Additional Details

AutoJemma® can make mistakes, please verify any critical information.