Ritevo

API connections

An API connection lets your own program work with your company's data, e.g. fetch orders or change their statuses. The program works on the account of the user who connected it: it has the same permissions, and its changes show in the history under that user's name, with the API source.

Where to find it

Click the gear icon at the bottom of the left menu and choose API connections. The list shows all connections of the company: name, Client ID, redirect address, who created it and who is connected through it. The counter under the heading shows how many connections you already have - a company can have at most 20.

The gear icon menu with API connections
The gear icon menu with API connections
The company list of API connections with the name, return address and connected users
The company list of API connections with the name, return address and connected users

Creating an API connection

Each connection gets a Client ID and a secret. You put them in the program's settings. The Client ID and secret alone do not open the account - the program gets access only when a user logs in and approves it.

  1. The administrator clicks Create API connection in the top right corner.
  2. They enter a name and a redirect address. The redirect address is the page of the program the user comes back to after approving the access.
  3. They click Create and copy the Client ID and Client secret into the program's settings.
  4. The program opens the login page for the user. The user logs in and clicks Allow, then comes back to the redirect address with a one-time code.
  5. The program exchanges the code for tokens and calls the API with the access token.
The create API connection window with the name and return address
The create API connection window with the name and return address
The Client ID and Client secret of a new API connection, shown only once
The Client ID and Client secret of a new API connection, shown only once
  • The redirect address must start with https and be reachable from the internet. http and localhost addresses are rejected.
  • You see the secret only once, right after creating the connection. Later it cannot be read - you can only generate a new one.
  • The connection name must not contain the word "Ritevo".
  • Only users of your company can connect through it, each with their own account.
  • The consent screen shows on every connection, also when the program was approved before. You always see which account the program gets access to.
  • Send the access token in the Authorization: Bearer header to https://api.ritevo.com.
  • Deleting a connection cuts off everyone who connected through it.

A new secret

  • If the secret is lost, the administrator generates a new one with the key icon next to the connection.
  • The old secret stops working at once.
  • Tokens the program already has keep working for at most an hour. After that the program refreshes the token with the new secret.

Disconnecting

  • Every connected user has the Disconnect icon. Anyone can disconnect themselves, the administrator can disconnect anyone.
  • A disconnected user loses access through the connection, including the tokens the program already has. To use the program again, they connect once more.
  • The other users stay connected.
  • A deactivated user is disconnected from all connections.

How long a connection lasts

  • The code from the login works once and only for a minute.
  • The access token works for an hour.
  • The refresh token works for 30 days and only once. Every refresh gives the program a new pair of tokens. If the program does not refresh for 30 days, it has to be connected again.
  • Protect the refresh token like a password. If someone takes it and uses it before your program does, the program gets an invalid_grant error on its next refresh. Then disconnect yourself with the Disconnect icon or ask the administrator to do it - this also cuts off whoever took the token. After that, connect the program again.

Change history

Changes made by the program show in the history under the name of the user who connected it, with the API source. This way you can tell the program's changes from your own. Audits keep, with the connection name, creating a connection, a new secret and deleting it, as well as every connecting and disconnecting of a program. Failed attempts are kept too, e.g. a refusal on the consent screen, a wrong secret or connecting a deactivated account. An attempt by someone outside the company is kept without their name.