Provision companies and users
Each of your customers gets its own Paprel company, with its own books. You create it with a partner token.
Create companies
Working in your own language? These samples use plain HTTP. You can generate a typed Partner API client from openapi-partner.json with the same generators; see SDKs and client libraries.
Create up to 100 companies per call, each with its owner:
curl https://api.paprel.com/v1/partner/companies \
--request POST \
--header 'Authorization: Bearer <partner token>' \
--header 'Content-Type: application/json' \
--data '{
"companies": [{
"external_company_id": "merchant-0001",
"company_name": "Kopi Kampung Sdn Bhd",
"country": "MY",
"currency": "MYR",
"locale": "en-MY",
"timezone": "Asia/Kuala_Lumpur",
"owner": { "external_user_id": "user-0001", "email": "owner@example.com", "name": "Aisyah Rahman" }
}]
}'
{
"data": [{
"external_company_id": "merchant-0001",
"outcome": "created",
"company_id": "<company id>",
"owner_user_id": "<user id>"
}]
}
Each item reports its own outcome:
| Outcome | Meaning |
|---|---|
created | New company and owner. Store company_id and owner_user_id against your own ids. |
existing | The same item was provisioned before. The existing ids are returned. |
failed | Not created. See error_code and error, for example 409 PARTNER_LIMIT_REACHED. |
country is ISO 3166-1 alpha-2, currency is ISO 4217, and locale looks like en-MY.
Retries are safe
Your external_company_id and external_user_id are the idempotency keys. Sending the same item again returns existing with the same ids, so a timed-out call can simply be repeated. Sending different data for an id that already exists returns 409 for that item; it never overwrites the company.
Add a user
To add another staff user to a company, send a role from that company's own role list as acl_id:
curl https://api.paprel.com/v1/partner/companies/<company_id>/users \
--request POST \
--header 'Authorization: Bearer <partner token>' \
--header 'Content-Type: application/json' \
--data '{ "external_user_id": "user-0002", "email": "finance@example.com", "name": "Daniel Tan", "acl_id": "<role id>" }'
- Portal roles (client, vendor) are refused with
400 INVALID_ROLE. - An
external_user_idyou already use elsewhere is reused, so one person can belong to several of your companies. - Partner-managed users have no password and cannot sign in directly. They reach Paprel only through sessions you mint.
- The users-per-company limit applies. See Limits and lifecycle.