API and API token

FlexiProject provides a REST API through which another system can read and change the organization’s data. This makes it possible to feed a BI report, synchronize projects with an ERP or automate a repetitive task. The full description of the endpoints is at developers.flexi-project.com.

To call the API, you need a personal access token (API token). You create the token yourself in your profile, on the API tab.

The token works with the permissions of its owner. The API returns exactly the data the owner sees in the application and nothing more. Two people with different roles therefore get different results from the same request.

Personal access token

Who can create a token

A token for their own account is created by a user with the Full license (see Licenses). The API tab is visible only to such users.

Important: Exchanging a token for an access token fails when the account is deactivated, removed from the organization or locked, or when the user no longer has the Full license.

Creating a token

  1. Open the avatar menu (avatar icon in the top right corner of the screen), choose User profile and go to the API tab (see Information tab). The list of tokens is displayed.
  2. Click New token. The New personal access token window opens.
  3. In the Name field, enter a name (up to 100 characters). The name should say which integration the token is used in, because it is the only way to tell tokens apart later.
  4. In the Expiration date field, set a date. The token expires at the end of the chosen day.
  5. Click Create token. FlexiProject creates the token and displays a window with its value.

The range of dates in the Expiration date field is:

  • The earliest date is tomorrow.
  • The latest date is 365 days from today.
  • By default, 30 days is set.

Avatar menu with User profile and the API tab in the user profile

Copy the token right away

The Personal access token created window shows the full value only once, with a warning: Copy the token and store it somewhere safe — once you close this window it can no longer be read.

The Copy button copies the value to the clipboard.

Warning: After you close the window, nobody can recover the value: not the user, not an administrator, not support. A lost token has to be deleted and created again.

Token list

The API tab lists the user’s tokens in the columns Name, Token, Created and Expires. The Token column shows only the first characters of the value, enough to match a token with the one saved in an integration.

API tab in the user profile listing two personal access tokens

The Expires column shows warnings in advance:

  • A token expiring within seven days has a tag with the number of days left.
  • A token expiring today has the tag expires today.
  • An expired token has the tag expired.

An expired token stays on the list until you delete it, but it no longer authenticates anything.

Important: You can have up to ten active tokens at a time. Expired tokens do not count towards the limit.

After the limit is reached, the New token button is inactive, and its tooltip says: You already have 10 active personal access tokens. Delete an unused token to create a new one.

Deleting a token

To delete a token, click the trash icon in its row (visible when you point at the row) and confirm. FlexiProject deletes the token.

Warning: Deletion cannot be undone. A deleted token can no longer be exchanged for an access token, and the integration has to get a new token with a new value. An access token issued earlier works until the end of its validity (60 minutes).

Using a token

Important: An API token is not sent with every request. It is exchanged once for an access token, and that access token is used from then on.

To exchange the token, send a POST to /api/users/token/personal with the email address and the token value:

POST /api/users/token/personal
Content-Type: application/json

{ "email": "anna.kowalska@example.com", "token": "fpat_…" }

The response contains the access_token, its type (token_type), the identifier of the organization the token belongs to (selectedTenantId) and the validity time of the access token in minutes (expires).

Send the access token in the Authorization header of subsequent calls. When it expires, repeat the exchange.

The email address must belong to the account that created the token. The token itself decides which organization you get into, so if you work in more than one organization, you need a separate token in each.

Repeated failed attempts are limited: after ten failed attempts for the same email address, further ones are rejected for fifteen minutes. If an integration suddenly starts getting refusals in bulk, check the saved value instead of retrying in a loop.

Exchanging an API token also works when password sign-in is switched off, because it is not a person signing in (see Sign-in methods).