Team members: API examples

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

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 };
}

createTenantUser

Invite a member. API Reference · Integration guide

POST /api/tenants/{id}/users

ParameterLocationRequired
idpathYes
API-VersionheaderYes

Request body: inviteAdmin

{
  "firstName": "Grace",
  "lastName": "Hopper",
  "email": "[email protected]",
  "roleName": "ADMIN"
}
const body = {
  "firstName": "Grace",
  "lastName": "Hopper",
  "email": "[email protected]",
  "roleName": "ADMIN"
};
const result = await request('POST', '/api/tenants/' + encodeURIComponent('<id>') + '/users', 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, 403, 404, 409, 500.

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

listTeamMembers

List team members. API Reference · Integration guide

GET /api/tenants/{id}/users

ParameterLocationRequired
idpathYes
API-VersionheaderYes
searchqueryNo
statusqueryNo
rolequeryNo
pagequeryNo
sizequeryNo
sortqueryNo
const body = undefined;
const result = await request('GET', '/api/tenants/' + encodeURIComponent('<id>') + '/users', 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, 403, 500.

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

removeTeamMember

Remove a team member. API Reference · Integration guide

DELETE /api/tenants/{id}/users/USERID

ParameterLocationRequired
API-VersionheaderYes
idpathYes
userIdpathYes
const body = undefined;
const result = await request('DELETE', '/api/tenants/' + encodeURIComponent('<id>') + '/users/' + encodeURIComponent('<userId>') + '', 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, 403, 404, 500.

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

changeUserRole

Change a member's role. API Reference · Integration guide

PATCH /api/tenants/{id}/users/USERID/role

ParameterLocationRequired
API-VersionheaderYes
idpathYes
userIdpathYes

Request body: toPlatformRole

{
  "roleName": "ADMIN"
}

Request body: toCustomRole

{
  "roleName": "Analyst"
}
const body = {
  "roleName": "ADMIN"
};
const result = await request('PATCH', '/api/tenants/' + encodeURIComponent('<id>') + '/users/' + encodeURIComponent('<userId>') + '/role', 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, 403, 404.

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


Did this page help you?