Contracts: API examples

Contract-derived requests, potential responses and API links for contracts.

Generated from the public OpenAPI. Examples illustrate the contract and are not live results. Use your assigned gateway, credentials and identifiers. The snippets do not execute automatically.

Use Node.js 22 or later. Copy the setup below into an .mjs file, set QFP_BASE_URL and QFP_ACCESS_TOKEN, then append the operation snippet you need. No repository checkout or downloaded client is required. Keep secrets in your backend and persist each write key and body before sending.

Request setup

const required = name => {
  const value = process.env[name];
  if (!value) throw new Error(`Set ${name} before running this example`);
  return value;
};
const baseUrl = required('QFP_BASE_URL').replace(/\/$/, '');
if (!/^https:\/\//.test(baseUrl)) throw new Error('Use your assigned HTTPS gateway');
const token = required('QFP_ACCESS_TOKEN');
const segment = value => encodeURIComponent(value);
async function request(method, path, body, key) {
  const headers = { Authorization: `Bearer ${token}`, 'API-Version': '1.0.0', Accept: 'application/json' };
  if (key) headers['Idempotency-Key'] = key;
  const multipart = body instanceof FormData;
  if (body !== undefined && !multipart) headers['Content-Type'] = 'application/json';
  const response = await fetch(baseUrl + path, {
    method, headers, body: body === undefined ? undefined : multipart ? body : JSON.stringify(body),
    signal: AbortSignal.timeout(30_000), redirect: 'error',
  });
  const text = await response.text();
  const data = text && response.headers.get('content-type')?.includes('json') ? JSON.parse(text) : text || null;
  if (!response.ok) {
    const error = new Error(`HTTP ${response.status}`);
    Object.assign(error, { status: response.status, data, headers: response.headers });
    throw error;
  }
  return { status: response.status, data };
}

deployContract

Deploy the token contract for an asset. API Reference · Integration guide

POST /api/contracts

ParameterLocationRequired
API-VersionheaderYes
Idempotency-KeyheaderYes

Request body: default

{
  "assetId": "GBP",
  "tokenName": "QFP Pound Sterling",
  "tokenSymbol": "qGBP",
  "adminAddress": "0xe0575c1841C47aFe3F741CD292015A6484e7BFA2"
}
const body = {
  "assetId": "GBP",
  "tokenName": "QFP Pound Sterling",
  "tokenSymbol": "qGBP",
  "adminAddress": "0xe0575c1841C47aFe3F741CD292015A6484e7BFA2"
};
const result = await request('POST', '/api/contracts', body, required('QFP_IDEMPOTENCY_KEY'));
console.log(result.status, result.data);

Replace angle-bracket placeholders before calling. Persist any idempotency key with the business instruction.

Potential responses

Documented statuses: 200, 202, 400, 401, 500.

Example 200 (default); see the reference for other outcomes.

{
  "transactionId": "036e32bb-a48b-467c-8652-d1fd4916fe90",
  "txType": "DEPLOY",
  "state": "CONFIRMED",
  "assetId": "GBP",
  "contractAddress": "0xd92e414Bb18f35E03A2eF47CE059e5f2ed75A455",
  "contractStatus": "ACTIVE",
  "createdAt": "2026-10-02T10:29:14.150Z",
  "updatedAt": "2026-10-02T10:31:02.419Z"
}

For CSV/download endpoints, the response may be text rather than JSON. The request helper preserves that distinction.

listContracts

List contracts. API Reference · Integration guide

GET /api/contracts

ParameterLocationRequired
API-VersionheaderYes
assetIdqueryNo
statusqueryNo
pagequeryNo
sizequeryNo
const body = undefined;
const result = await request('GET', '/api/contracts', body, undefined);
console.log(result.status, result.data);

Replace angle-bracket placeholders before calling. Persist any idempotency key with the business instruction.

Potential responses

Documented statuses: 200, 400, 401, 500.

Example 200 (default); see the reference for other outcomes.

{
  "content": [
    {
      "id": "3f6c1b2a-9d54-4e7c-8b31-0a2f5c7d9e10",
      "tenantId": "11111111-1111-1111-1111-111111111111",
      "assetId": "USD",
      "contractAddress": "0x7c3aEd41D0f3b6a92cF8e0d1B54a2eD9c15b8A64",
      "decimals": 6,
      "ownerKeyReference": "treasury-owner-key-1",
      "custodyProvider": "fireblocks",
      "custodyKeyRef": "vault-7f1c2d9e",
      "status": "ACTIVE",
      "createdAt": "2026-08-03T09:29:10.285Z",
      "updatedAt": "2026-08-03T09:29:10.285Z"
    }
  ],
  "page": 0,
  "size": 20,
  "totalElements": 1,
  "totalPages": 1
}

For CSV/download endpoints, the response may be text rather than JSON. The request helper preserves that distinction.

updateContractStatus

Activate or deactivate a contract. API Reference · Integration guide

PATCH /api/contracts/{assetId}

ParameterLocationRequired
API-VersionheaderYes
assetIdpathYes

Request body: default

{
  "status": "INACTIVE"
}
const body = {
  "status": "INACTIVE"
};
const result = await request('PATCH', '/api/contracts/' + encodeURIComponent('<assetId>') + '', body, undefined);
console.log(result.status, result.data);

Replace angle-bracket placeholders before calling. Persist any idempotency key with the business instruction.

Potential responses

Documented statuses: 200, 400, 401, 404, 500.

Example 200 (default); see the reference for other outcomes.

{
  "id": "3f6c1b2a-9d54-4e7c-8b31-0a2f5c7d9e10",
  "tenantId": "11111111-1111-1111-1111-111111111111",
  "assetId": "USD",
  "contractAddress": "0x7c3aEd41D0f3b6a92cF8e0d1B54a2eD9c15b8A64",
  "decimals": 6,
  "ownerKeyReference": "treasury-owner-key-1",
  "custodyProvider": "fireblocks",
  "custodyKeyRef": "vault-7f1c2d9e",
  "status": "INACTIVE",
  "createdAt": "2026-08-03T09:29:10.285Z",
  "updatedAt": "2026-08-05T11:41:06.902Z"
}

For CSV/download endpoints, the response may be text rather than JSON. The request helper preserves that distinction.


Did this page help you?