Skip to main content
Use CommCare through Corsair: one client, typed API calls. Generate an API key in CommCare HQ under Account Settings, API Keys (the key belongs to your CommCare username). Because ApiKey auth is user-scoped, every operation takes the project domain and that username as inputs. Things to know before you call:
  • API access needs a plan. The JSON APIs require a Standard plan or above; on a free project they answer 401 “Your current subscription does not have access to this feature” (or 403). ota.restore is the exception: it works on a free project.
  • Every endpoint is scoped to one project. All requests go to https://www.commcarehq.org/a/{domain}/.... There is no plugin-level domain or username option: pass both on every call.
  • Two pagination styles. Most listings use limit and offset with a meta.total_count; cases.list pages oldest-to-newest by cursor: pass the nextCursor it answers as cursor until nextCursor is absent.
  • Async bulk actions. forms.bulkAction accepts up to 5000 form ids for archive, unarchive or permanent delete, and answers a job id; follow with forms.bulkActionStatus until status is complete or failed. complete does not mean every form succeeded: compare succeeded with requested and read skipped. A form must be archived before it can be deleted.
  • Writes. submissions.submit posts OpenRosa XForm XML to the receiver. HQ answers 201 even when it could not process the form; the call fails in that case (nature submit_error or processing_failure) and otherwise returns the message and its nature. users.create provisions a worker account with an initial password.
  • Delete is permanent. users.delete removes a worker account, and forms.bulkAction with action delete permanently removes forms.
  • OTA restore auth. ota.restore pulls the full case-restore XML. The docs show worker Basic credentials, but HQ also accepts the ApiKey header and restores the account that owns the key, so a web user’s key returns that user’s restore, not a mobile worker’s. HQ puts the owner’s password hash in the restore’s registration block; the plugin replaces it with [removed] before returning the XML.
What you get:
  • 32 typed API operations

Setup

1

Install

2

Add the plugin

corsair.ts
With multiTenancy: true, scope calls with corsair.withTenant(id). See Quick start for KEK + Hub keys, and Multi-tenancy for account isolation.
3

Choose authentication

4

Connect a tenant

Mint a connect link and send the tenant to it. Hub hosts the page and delivers the result to your app — see Connect / OAuth.

Example API calls

List open cases of a type
Add a mobile worker
See the full list on the API page.

What’s next

API reference

Every commcare.api.* operation with input and output types.

Connect / OAuth

createLink, Hub delivery, and tenant connect flows.

Use with agents

Expose this plugin’s operations as MCP tools.