SDKs

Integre com cURL ou qualquer cliente HTTP. Os SDKs oficiais seguirão os mesmos contratos REST.

export async function sigesc(path, { method = "GET", body, idempotencyKey } = {}) {
  const res = await fetch(`https://api.sigesc.ao/v1${path}`, {
    method,
    headers: {
      Authorization: `Bearer ${process.env.SIGESC_API_KEY}`,
      "Content-Type": "application/json",
      ...(idempotencyKey ? { "Idempotency-Key": idempotencyKey } : {}),
    },
    body: body ? JSON.stringify(body) : undefined,
  });
  const data = await res.json();
  if (!res.ok) throw Object.assign(new Error(data.error?.message), data.error);
  return data;
}