Skip to main content
REST client

Orgs

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

2 min read
View MarkdownEdit on GitHub

Orgs

Available from @codespar/sdk 0.12.0, which is not on npm yet. The published version today is 0.11.0, and it has no cs.api; 0.12.0 is on the main branch of codespar-core. The examples below are not compiled against the installed package for that reason.

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 { CodeSpar } from "@codespar/sdk";

const cs = new CodeSpar({ apiKey: process.env.CODESPAR_API_KEY });

POST /v1/orgs/{orgId}/agents

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

Register an agent identity and mint its first signing key

const r = await cs.api.response("post", "/v1/orgs/{orgId}/agents", {
  path: {
    orgId: "org_0000000000000000"
  },
  body: {
    agent_id: "agt_0000000000000000",
    display_name: "Example",
    principal_ref: "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 (r.ok) {
  console.log(r.data);
}

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 r = await cs.api.response("post", "/v1/orgs/{orgId}/agents/{agentId}/keys/rotate", {
  path: {
    orgId: "org_0000000000000000",
    agentId: "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 (r.ok) {
  console.log(r.data);
}

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 r = await cs.api.response("post", "/v1/orgs/{orgId}/agents/{agentId}/keys/{kid}/revoke", {
  path: {
    orgId: "org_0000000000000000",
    agentId: "agt_0000000000000000",
    kid: "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 (r.ok) {
  console.log(r.data);
}

Parameters, body and every documented response: POST /v1/orgs/{orgId}/agents/{agentId}/keys/{kid}/revoke 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 result = await cs.api.get("/v1/orgs/{orgId}/approvals/health", {
  path: {
    orgId: "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 result = await cs.api.get("/v1/orgs/{orgId}/approvals/{id}", {
  path: {
    orgId: "org_0000000000000000",
    id: "approval_0000000000000000"
  }
});

Parameters, body and every documented response: GET /v1/orgs/{orgId}/approvals/{id} 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 r = await cs.api.response("get", "/v1/orgs/{orgId}/audit/config", {
  path: {
    orgId: "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 (r.ok) {
  console.log(r.data);
}

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 r = await cs.api.response("patch", "/v1/orgs/{orgId}/audit/config", {
  path: {
    orgId: "org_0000000000000000"
  },
  body: {
    verification_window_days: 0,
    hot_window_days: 0,
    hot_max_staleness_seconds: 1,
    warm_window_days: 0,
    warm_max_staleness_seconds: 1,
    cold_max_staleness_seconds: 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 (r.ok) {
  console.log(r.data);
}

Parameters, body and every documented response: PATCH /v1/orgs/{orgId}/audit/config 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 r = await cs.api.response("get", "/v1/orgs/{orgId}/audit/health", {
  path: {
    orgId: "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 (r.ok) {
  console.log(r.data);
}

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 r = await cs.api.response("get", "/v1/orgs/{orgId}/audit/incidents", {
  path: {
    orgId: "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 (r.ok) {
  console.log(r.data);
}

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 r = await cs.api.response("post", "/v1/orgs/{orgId}/audit/incidents/{id}/acknowledge", {
  path: {
    orgId: "org_0000000000000000",
    id: "incident_0000000000000000"
  },
  body: {
    resolution_summary: "string",
    anpd_notification_status: "not_required",
    personal_data_affected: true
  }
});
// 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 (r.ok) {
  console.log(r.data);
}

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

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

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

const r = await cs.api.response("post", "/v1/orgs/{orgId}/data-subjects/{userId}/anonymize", {
  path: {
    orgId: "org_0000000000000000",
    userId: "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 (r.ok) {
  console.log(r.data);
}

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

GET /v1/orgs/{orgId}/mandates

GET/v1/orgs/{orgId}/mandates

List the org's mandates

const result = await cs.api.get("/v1/orgs/{orgId}/mandates", {
  path: {
    orgId: "org_0000000000000000"
  }
});

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

POST /v1/orgs/{orgId}/mandates

POST/v1/orgs/{orgId}/mandates

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

const r = await cs.api.response("post", "/v1/orgs/{orgId}/mandates", {
  path: {
    orgId: "org_0000000000000000"
  },
  body: {
    agent_id: "agt_0000000000000000",
    type: "payment",
    amount: "1000",
    currency: "BRL",
    purposes: [
      "string"
    ],
    expires_at: 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 (r.ok) {
  console.log(r.data);
}

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

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

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

Read one mandate with its consumption history

const result = await cs.api.get("/v1/orgs/{orgId}/mandates/{id}", {
  path: {
    orgId: "org_0000000000000000",
    id: "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

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

Revoke a mandate

const result = await cs.api.post("/v1/orgs/{orgId}/mandates/{id}/revoke", {
  path: {
    orgId: "org_0000000000000000",
    id: "mandate_0000000000000000"
  },
  body: {
    reason: "string"
  }
});

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

Orgs | CodeSpar