Needs permission api-token:write.
Issues a new client credential for your account. The response carries clientSecret exactly once — store it before doing anything else. Retrying with the same Idempotency-Key answers 200 with the token already made and no secret; if the secret has been lost, rotate the token.
roleId is the token's role (GET /roles, those listing api-token in assignableTo); leave it out for your account's default role. A token's role never covers API tokens, roles or the account, whatever it says. Giving a token a role needs a caller who manages API tokens where it applies (403 access_management_denied otherwise; a person or an API token alike), and the role's permissions must be ones you hold (403 role_assignment_denied). A role for people only answers 400 role_not_assignable, and while only Administrator can be given out any other role answers 400 role_not_yet_available. A role you leave out on access it did not have is your account's default role (GET /customer/access-settings), and administrator while only Administrator can be given out; when that default role is for people only, the token is refused with 400 role_not_assignable and you name its role. Every response lists the token's role at each place in roles.
allowedIpRanges lists the address ranges the token may be used from: 1 to 20, IPv4 or IPv6, such as 203.0.113.0/24 or 2001:db8::/32, with no spaces or leading zeros. Each is stored as its network address. From anywhere else every API, this one included, answers 403 ip_not_allowed. 400 invalid_ip_range names a range we cannot use. Only a person changes or lifts an existing token's ranges: an API token is refused with 403 insufficient_permissions, missingPermission: api-token:write. An API token restricted to ranges issues or rotates only tokens within them (403 token_ranges_wider_than_yours); one it issues without ranges gets its own. Leave it out to allow any address.
State what the token reaches as either organisationIds or allOrganisations: true, never both. allOrganisations grants account-wide access — every organisation the account owns, including ones added later — and only somebody who already holds account-wide access may grant it (403 whole_customer_access_denied otherwise). name is 3 to 100 characters and unique within your account.
An account may hold 5 API tokens, counting every client credential it holds and not only the ones created here. Being over the limit revokes nothing; it only refuses a new one. Three things answer 409, told apart by message.token:
token_limit_reached— the account already holds 5 tokens. Revoke one that is no longer used, or contact support to raise the allowance.duplicate_token_name— another token in your account has that name.idempotency_key_reused— thatIdempotency-Keywas already used for a different request body.
403 billing_not_set_up when billing is not set up for the account yet — email [email protected] to agree pricing and set it up. Accounts onboarded by Flow Payroll are already set up.
| Time | Status | User Agent | |
|---|---|---|---|
Retrieving recent requests… | |||
