Skip to main content
REST client

Orgs

The 20 operations under orgs, as typed calls on the generated REST client.

3 min read
View MarkdownEdit on GitHub

Available from @codespar/sdk 0.12.0; the version on npm is 0.16.18. When these docs build, the examples on this page are compiled against @codespar/sdk 0.16.18, the version this site installs: a call that does not type-check against it fails the build.

Every call below is cs.api reaching one operation of the OpenAPI document this page was generated from; the REST client overview explains request, response, the option bag and the errors. The values are placeholders shaped by the document.

import {  } from "@codespar/sdk";

const  = new ({ : .. });

POST /v1/orgs/{orgId}/agents

POST/v1/orgs/{orgId}/agents
Deprecated

Register an agent identity and mint its first signing key

const  = await ..("post", "/v1/orgs/{orgId}/agents", {
  : {
    : "org_0000000000000000"
  },
  : {
    : "agt_0000000000000000",
    : "Example",
    : "string",
    : {
      : "sdk",
      : "string"
    },
    : "string"
  }
});
// r.status is one of the documented statuses (200, 403),
// each with its own body shape in r.data; nothing here throws on 403.
if (.) {
  .(.);
}

Parameters, body and every documented response: POST /v1/orgs/{orgId}/agents in the HTTP reference.

POST /v1/orgs/{orgId}/agents/{agentId}/keys/rotate

POST/v1/orgs/{orgId}/agents/{agentId}/keys/rotate
Deprecated

Retire the agent's active key and mint a fresh one

const  = await ..("post", "/v1/orgs/{orgId}/agents/{agentId}/keys/rotate", {
  : {
    : "org_0000000000000000",
    : "agt_0000000000000000"
  }
});
// r.status is one of the documented statuses (200, 403),
// each with its own body shape in r.data; nothing here throws on 403.
if (.) {
  .(.);
}

Parameters, body and every documented response: POST /v1/orgs/{orgId}/agents/{agentId}/keys/rotate in the HTTP reference.

POST /v1/orgs/{orgId}/agents/{agentId}/keys/{kid}/revoke

POST/v1/orgs/{orgId}/agents/{agentId}/keys/{kid}/revoke
Deprecated

Hard-revoke one of an agent's signing keys

const  = await ..("post", "/v1/orgs/{orgId}/agents/{agentId}/keys/{kid}/revoke", {
  : {
    : "org_0000000000000000",
    : "agt_0000000000000000",
    : "string"
  }
});
// r.status is one of the documented statuses (200, 403),
// each with its own body shape in r.data; nothing here throws on 403.
if (.) {
  .(.);
}

Parameters, body and every documented response: POST /v1/orgs/{orgId}/agents/{agentId}/keys/{kid}/revoke in the HTTP reference.

GET /v1/orgs/{orgId}/approvals

GET/v1/orgs/{orgId}/approvals
Deprecated

List approvals held for review (deprecated path)

const  = await ..("/v1/orgs/{orgId}/approvals", {
  : {
    : "org_0000000000000000"
  }
});

Parameters, body and every documented response: GET /v1/orgs/{orgId}/approvals in the HTTP reference.

GET /v1/orgs/{orgId}/approvals/health

GET/v1/orgs/{orgId}/approvals/health
Deprecated

Queue depth and the age of the oldest pending approval

const  = await ..("/v1/orgs/{orgId}/approvals/health", {
  : {
    : "org_0000000000000000"
  }
});

Parameters, body and every documented response: GET /v1/orgs/{orgId}/approvals/health in the HTTP reference.

GET /v1/orgs/{orgId}/approvals/{id}

GET/v1/orgs/{orgId}/approvals/{id}
Deprecated

Read one approval, including the tool arguments held for review

const  = await ..("/v1/orgs/{orgId}/approvals/{id}", {
  : {
    : "org_0000000000000000",
    : "approval_0000000000000000"
  }
});

Parameters, body and every documented response: GET /v1/orgs/{orgId}/approvals/{id} in the HTTP reference.

POST /v1/orgs/{orgId}/approvals/{id}/decide

POST/v1/orgs/{orgId}/approvals/{id}/decide
Deprecated

Approve or deny a held call (deprecated path)

const  = await ..("post", "/v1/orgs/{orgId}/approvals/{id}/decide", {
  : {
    : "org_0000000000000000",
    : "approval_0000000000000000"
  },
  : {
    : "approve",
    : "string"
  }
});
// r.status is one of the documented statuses (200, 403),
// each with its own body shape in r.data; nothing here throws on 403.
if (.) {
  .(.);
}

Parameters, body and every documented response: POST /v1/orgs/{orgId}/approvals/{id}/decide in the HTTP reference.

GET /v1/orgs/{orgId}/audit/config

GET/v1/orgs/{orgId}/audit/config
Deprecated

Read the chain verification windows and staleness budgets

const  = await ..("get", "/v1/orgs/{orgId}/audit/config", {
  : {
    : "org_0000000000000000"
  }
});
// r.status is one of the documented statuses (200, 403),
// each with its own body shape in r.data; nothing here throws on 403.
if (.) {
  .(.);
}

Parameters, body and every documented response: GET /v1/orgs/{orgId}/audit/config in the HTTP reference.

PATCH /v1/orgs/{orgId}/audit/config

PATCH/v1/orgs/{orgId}/audit/config
Deprecated

Update the chain verification windows and staleness budgets

const  = await ..("patch", "/v1/orgs/{orgId}/audit/config", {
  : {
    : "org_0000000000000000"
  },
  : {
    : 0,
    : 0,
    : 1,
    : 0,
    : 1,
    : 1
  }
});
// r.status is one of the documented statuses (200, 403),
// each with its own body shape in r.data; nothing here throws on 403.
if (.) {
  .(.);
}

Parameters, body and every documented response: PATCH /v1/orgs/{orgId}/audit/config in the HTTP reference.

GET /v1/orgs/{orgId}/audit/export

GET/v1/orgs/{orgId}/audit/export
Deprecated

Export audit events, with a signed manifest (deprecated path)

const  = await ..("get", "/v1/orgs/{orgId}/audit/export", {
  : {
    : "org_0000000000000000"
  },
  : {
    : "string",
    : "string"
  }
});
// r.status is one of the documented statuses (200, 403),
// each with its own body shape in r.data; nothing here throws on 403.
if (.) {
  .(.);
}

Parameters, body and every documented response: GET /v1/orgs/{orgId}/audit/export in the HTTP reference.

GET /v1/orgs/{orgId}/audit/health

GET/v1/orgs/{orgId}/audit/health
Deprecated

How far the chain verifier got, and whether what it walked was linked

const  = await ..("get", "/v1/orgs/{orgId}/audit/health", {
  : {
    : "org_0000000000000000"
  }
});
// r.status is one of the documented statuses (200, 403),
// each with its own body shape in r.data; nothing here throws on 403.
if (.) {
  .(.);
}

Parameters, body and every documented response: GET /v1/orgs/{orgId}/audit/health in the HTTP reference.

GET /v1/orgs/{orgId}/audit/incidents

GET/v1/orgs/{orgId}/audit/incidents
Deprecated

List chain-integrity incidents

const  = await ..("get", "/v1/orgs/{orgId}/audit/incidents", {
  : {
    : "org_0000000000000000"
  }
});
// r.status is one of the documented statuses (200, 403),
// each with its own body shape in r.data; nothing here throws on 403.
if (.) {
  .(.);
}

Parameters, body and every documented response: GET /v1/orgs/{orgId}/audit/incidents in the HTTP reference.

POST /v1/orgs/{orgId}/audit/incidents/{id}/acknowledge

POST/v1/orgs/{orgId}/audit/incidents/{id}/acknowledge
Deprecated

Acknowledge a chain-integrity incident and write the acknowledgement into the chain

const  = await ..("post", "/v1/orgs/{orgId}/audit/incidents/{id}/acknowledge", {
  : {
    : "org_0000000000000000",
    : "incident_0000000000000000"
  },
  : {
    : "string",
    : "not_required",
    : true,
    : "string",
    : 0,
    : 0
  }
});
// r.status is one of the documented statuses (200, 403),
// each with its own body shape in r.data; nothing here throws on 403.
if (.) {
  .(.);
}

Parameters, body and every documented response: POST /v1/orgs/{orgId}/audit/incidents/{id}/acknowledge in the HTTP reference.

POST /v1/orgs/{orgId}/data-subjects/{userId}/anonymize

Erase a data subject's personal data across the audit chain (LGPD Art. 18)

const  = await ..("post", "/v1/orgs/{orgId}/data-subjects/{userId}/anonymize", {
  : {
    : "org_0000000000000000",
    : "user_0000000000000000"
  }
});
// r.status is one of the documented statuses (200, 403),
// each with its own body shape in r.data; nothing here throws on 403.
if (.) {
  .(.);
}

Parameters, body and every documented response: POST /v1/orgs/{orgId}/data-subjects/{userId}/anonymize in the HTTP reference.

GET /v1/orgs/{orgId}/mandates

List the org's mandates

const  = await ..("/v1/orgs/{orgId}/mandates", {
  : {
    : "org_0000000000000000"
  }
});

Parameters, body and every documented response: GET /v1/orgs/{orgId}/mandates in the HTTP reference.

POST /v1/orgs/{orgId}/mandates

Issue an org-side mandate (off by default, see the 501)

const  = await ..("post", "/v1/orgs/{orgId}/mandates", {
  : {
    : "org_0000000000000000"
  },
  : {
    : "agt_0000000000000000",
    : "payment",
    : "1000",
    : "BRL",
    : [
      "string"
    ],
    : 0,
    : "1000",
    : "string",
    : "parent_0000000000000000"
  }
});
// r.status is one of the documented statuses (200, 403),
// each with its own body shape in r.data; nothing here throws on 403.
if (.) {
  .(.);
}

Parameters, body and every documented response: POST /v1/orgs/{orgId}/mandates in the HTTP reference.

GET /v1/orgs/{orgId}/mandates/{id}

Read one mandate with its consumption history

const  = await ..("/v1/orgs/{orgId}/mandates/{id}", {
  : {
    : "org_0000000000000000",
    : "mandate_0000000000000000"
  }
});

Parameters, body and every documented response: GET /v1/orgs/{orgId}/mandates/{id} in the HTTP reference.

POST /v1/orgs/{orgId}/mandates/{id}/revoke

Revoke a mandate

const  = await ..("/v1/orgs/{orgId}/mandates/{id}/revoke", {
  : {
    : "org_0000000000000000",
    : "mandate_0000000000000000"
  },
  : {
    : "string"
  }
});

Parameters, body and every documented response: POST /v1/orgs/{orgId}/mandates/{id}/revoke in the HTTP reference.

GET /v1/orgs/{orgId}/pause

Read the organization kill switch

const  = await ..("/v1/orgs/{orgId}/pause", {
  : {
    : "org_0000000000000000"
  }
});

Parameters, body and every documented response: GET /v1/orgs/{orgId}/pause in the HTTP reference.

POST /v1/orgs/{orgId}/pause

Pause all agent spend of the organization (kill switch)

const  = await ..("post", "/v1/orgs/{orgId}/pause", {
  : {
    : "org_0000000000000000"
  },
  : {
    : "string"
  }
});
// r.status is one of the documented statuses (200, 403),
// each with its own body shape in r.data; nothing here throws on 403.
if (.) {
  .(.);
}

Parameters, body and every documented response: POST /v1/orgs/{orgId}/pause in the HTTP reference.

Orgs | CodeSpar