Authentication
Every request to the OneSuite API carries a personal access token. A token belongs to one person in one business: it acts as that person, inside that business, and nothing else. A token can do only what its person can do in OneSuite.
Creating a token
Section titled “Creating a token”You create a token in your OneSuite business settings, while working in the business the token is for. Give it a name that says where it will be used, such as the script or integration that needs it.
The token identifies both you and the business, so no other header is needed to say which business a request is for. If you belong to more than one business, create a token in each one.
Anyone who has your token can do what you can do in that business. Keep it secret, as you would a password: do not share it, and do not commit it to source control.
Sending the token
Section titled “Sending the token”Send the token in the X-API-Key header:
curl "https://api.onesuite.io/v1/work-types" \ -H "X-API-Key: $ONESUITE_TOKEN"or as a bearer token in the Authorization header:
curl "https://api.onesuite.io/v1/work-types" \ -H "Authorization: Bearer $ONESUITE_TOKEN"Both work the same way on every endpoint. From a web browser, use Authorization: Bearer: the API does not accept the X-API-Key header in a request a browser sends to it from another site. The examples on these pages use X-API-Key and read the token from the ONESUITE_TOKEN environment variable.
What a token may do
Section titled “What a token may do”A token can do exactly what its person can do in the OneSuite app, no more and no less. Every endpoint checks the same permissions the app checks for the same action:
- Permissions. An action the person is not allowed to take is refused.
- Who and what they see. A person who may see only their own time gets only their own time entries; a manager sees the people and projects they manage; an administrator sees the whole business. Lists simply leave out what the person may not see.
- Rates and budgets. Amounts the person may not see, such as other people’s rates or a project’s budget, come back as
null. - Locks and approvals. Time and expenses that are locked or approved can be changed only by those the app lets change them.
Each page says, under “Who can use it”, who may read and change its records.
When a request is refused
Section titled “When a request is refused”The answer is 403 when the token is missing, is not a valid token, or belongs to a person who is not allowed to do what the request asks. A record that exists but that the person may not see answers 404, the same as a record that does not exist. See Errors and rate limits for the answer’s body and the other status codes.