An API key lets another system, such as your accounting, your payroll or an automation platform, call the Rekruti API without anyone logging in. It is the other half of the webhooks: a webhook tells the other system that something happened, and the API key lets that system read the details, or write back to Rekruti.
1. What an API key is for
Almost every function of the Rekruti API needs to know who is calling. A person proves it by logging in; a system, which cannot type a password nor keep a session, proves it with an API key, sent with every call. With it, the other system can, for instance:
- read the timesheet, the job or the candidate a webhook just told it about;
- list the invoices of a period, to enter them in your accounting;
- tell Rekruti that those invoices are entered, or paid;
- create or update records, on behalf of your agency.
2. A key acts as a user
An API key belongs to the user who creates it. A call made with the key is made as that user: it sees what that user sees and may do what that user may do, no more. If that user is disabled or deleted, their keys stop working.
One user per integration
Create a user of your agency for each system that calls the API, such as Accounting integration, with only the rights that system needs, and create its key while logged in as that user. What the system does is then told apart from what your team does, and its access can be cut without touching anybody else.
3. Creating a key
Under SysAdmin, API-Key, add a key. Only a user with the SysAdmin role sees this page.
| Field | What it is |
|---|---|
| Name | What the key is for, such as QuickBooks, to know it again later. |
| Expiration Date | Optional. From that day on, the key no longer works. Empty: it never expires. |
The list shows, for each key, its Name, its Value (the key itself, to copy into the other system), the Account it acts as, and its Expiration Date. You can have as many keys as you need: one per system is best. Deleting a key cuts its access at once.
4. Calling the API with a key
Send the key in a header of every call, either one:
X-API-Key: YOUR-KEY
Authorization: Bearer YOUR-KEY
The functions of the API are at https://{your Rekruti address}/api/{entity}/{function}, such
as /api/job/read. A function that reads may be called with GET, its
parameters in the address:
GET https://{your Rekruti address}/api/job/read?gid=886428bc-88e5-41f3-889e-a730240b1ab1
X-API-Key: YOUR-KEY
Every function may be called with POST, its parameters in a JSON body:
POST https://{your Rekruti address}/api/job/read
X-API-Key: YOUR-KEY
Content-Type: application/json
{ "gid": "886428bc-88e5-41f3-889e-a730240b1ab1" }
The values that have a language, such as labels, come back in the language of the user of the key. To
choose, send the header Language: fr or Language: en; it also becomes the
language of that user.
5. An example: invoices into your accounting
To enter the payables in your accounting the moment your agency sends them:
| Step | What happens |
|---|---|
| 1. The webhook | A webhook on Payable Period Send calls your integration with the gid of the period (see Webhooks). |
| 2. The invoices | With its API key, the integration calls
payablePeriod/listInvoices for that period, then payable/listForReport
for the details of the invoices: the candidate, the lines, the amounts, the taxes. |
| 3. Your accounting | The integration checks that the supplier and the invoice are not in your accounting already, then enters them. |
| 4. The status | It calls payable/setPostingStatus to tell Rekruti how it
went: posted, post error, and later paid. Your team sees it on each
payable. |
The receivables work the same way, with Receivable Period Send,
receivablePeriod/listInvoices, receivable/listForReport and
receivable/setPostingStatus.
6. Keeping your keys safe
- A key is a password — whoever has it acts as its user. Keep it in the settings of the system that uses it, never in an email, a document or a web page.
- Give it an expiration date when the integration is a trial or has an end.
- A leaked key — delete it at once and create a new one: the old one stops working immediately.
- Someone leaves — the keys they created act as them: if their account is disabled, those keys stop. Another reason for a user of its own per integration.
- 401 or access refused — the key is mistyped, deleted or expired, or its user is disabled, or that user is not allowed to do what is asked.
A question this guide does not answer? Ask our assistant, at the bottom right of this page, or write to us.