Books by finzkoDevelopers

Partner & provisioning

For integrators, CAs and resellers who create and manage organizations on behalf of their clients: create an organization and mint its API token, list your organizations, re-issue a token, suspend and reactivate. A partner only ever sees the organizations it created.

Authentication

These routes do not use a bearer token or an AIBooks.* scope. Send your partner key in a header:

X-Partner-Key: aibk_partner_…
  • 401 partner.unauthorized — header missing, or the key is not recognised.
  • 403 partner.suspended — the partner account is not ACTIVE.

Because there is no bearer token, these calls are rate limited as anonymous traffic (60 requests per minute per IP address); see Rate limits. Responses are plain objects with camelCase fields. They do not use the { code, message, <resource> } envelope.

POST/partner/organizationsCreate a client organization and mint its tokenX-Partner-Key

Idempotency-Key is required (400 idempotency.key_required without it).

Body

FieldTypeNotes
namestringRequired. Business name.
statestringRequired. Primary state; any common shape, stored as IN-XX.
ownerEmailstringRequired. Must contain @. The owner user is created from it.
ownerNamestring?
gstinstring?
panstring?
currencystringDefault INR.
fyStartMonthint1 – 12, default 4 (April).
externalRefstring?Your own id for this client; saved on the organization.
tokenDescriptionstring?Label for the minted token.
scopesstring[]?Scopes for the token. Defaults to your partner scopes.
isTestboolDefault false.

Field names are camelCase here (snake_case is also accepted for the same fields).

POST /partner/organizations
X-Partner-Key: aibk_partner_…
Idempotency-Key: 7c1d…
Content-Type: application/json

{
  "name": "Sharma Traders",
  "state": "IN-MH",
  "ownerEmail": "owner@sharmatraders.example",
  "gstin": "27AABCC1234D1Z5",
  "externalRef": "crm-4821"
}

201 Created
{
  "success": true,
  "organizationId": "org_…",
  "organizationName": "Sharma Traders",
  "ownerUserId": "usr_…",
  "token": "aibk_pat_…",            // shown once; not retrievable again
  "tokenPrefix": "aibk_pat_ab12",
  "scopes": [ … ],                  // the scopes granted to the token
  "apiBaseUrl": "/api/public/v1",
  "note": "Use `token` as a Bearer PAT against /api/public/v1 endpoints. It is not retrievable again."
}

Store tokenimmediately. Use it as the bearer token for that client's organization on every other page of this reference. A bad value returns 400 validation (bare string code) with the message, for example a missing name or an ownerEmail without @.

POST/provision/organizationSame as above (legacy alias)X-Partner-Key

Kept for older integrations. Same body, same response, same Idempotency-Key requirement and same X-Partner-Key auth as POST /partner/organizations. Use that one in new code.

GET/partner/organizationsList your organizationsX-Partner-Key
200 OK
{
  "success": true,
  "items": [
    { "id": "org_…", "name": "Sharma Traders", "state": "IN-MH", "gstin": "27AABCC1234D1Z5",
      "status": "ACTIVE", "createdAt": "2026-05-12T08:30:00" }
  ]
}

Newest first. Not paginated: every organization is returned.

GET/partner/organizations/{org_id}Get one of your organizationsX-Partner-Key

Returns the object above (no wrapper). An id that is not yours returns 404 not_found (bare string code).

POST/partner/organizations/{org_id}/tokenRe-issue an API token (CA book access)X-Partner-Key

Mints a new token bound to the organization's owner, with your partner scopes. No body, and no Idempotency-Key is required, so every call mints a new token.

200 OK
{
  "success": true,
  "organizationId": "org_…",
  "token": "aibk_pat_…",
  "tokenPrefix": "aibk_pat_cd34",
  "scopes": [ … ],
  "note": "Use as a Bearer PAT on /api/public/v1. Shown once."
}

409 no_owner if the organization has no owner to bind the token to.

POST/partner/organizations/{org_id}/suspendSuspend an organizationX-Partner-Key
POST/partner/organizations/{org_id}/reactivateReactivate an organizationX-Partner-Key

No body. Sets the organization's status to SUSPENDED or ACTIVE and returns the organization object. Calling either twice is harmless.