Tutorial · Step 16 of 20

Choose the scopes

Each key names its scopes and its lifetime. Both are decided here, in one form, and both follow the key for as long as it exists: widening a scope later means issuing another key.

Before you start

  • The API keys page open on the right project, from step 15.
  • A one-line answer to "what does this integration do?". The scopes follow from it, and the minimum set is usually smaller than it looks.
  • The expiry the integration can live with. A script run once a night rarely needs a key that never expires.

Choose the scopes

Click Create a key. The form opens on the same page, headed New key. Type a name, tick the scopes the integration needs, pick an expiration, then click Create key, which shows Creating... while the request runs.

The creation form: a name, seven scope checkboxes, and the expiration select. Open this page

What the form asks for

Three decisions. The name is free text; the other two come from closed lists, so a typo cannot produce a scope the server would ignore.

NameTypeDefaultDescription
Name*textWhat the key is for, for example "Backup script". It is the only thing that tells you later where a key is used, so name the integration, not the project.
Scopes*checkbox listSeven checkboxes, and at least one must be ticked. A key can only do what is ticked here: this choice is what bounds a leaked key.
Expirationselect30 days, 90 days, 1 year or No expiration. 90 days is preselected. The value is a lifetime counted from creation, not a calendar date.

The seven scopes, as they are labelled in the form. Tick the minimum the integration needs, and nothing more.

NameTypeDefaultDescription
documents:readDocuments, readList and download documents.
documents:writeDocuments, writeUpload and delete documents.
chat:writeChatAsk questions against the corpus.
widget:readWidget, readRead the widget configuration.
widget:writeWidget, writeChange the widget configuration.
analytics:readAnalyticsRead usage statistics.
billing:readBillingRead payments and invoices.
Two scopes the form does not show
The server also accepts account:write and * (all scopes). Neither is a checkbox here, so a key created from this page can never be a full-access key by accident.

A scope says what kind of action a key may take, not which corpus it reads. The corpus is bounded by the project the key was issued for.

What you see when it worked

  1. The form closes and the key appears under Active, with the count going up by one.
  2. The row shows the name you typed and the 12-character prefix followed by an ellipsis.
  3. The key value itself appears in a highlighted panel above the list, which is step 17.
  4. The form is reset: name empty, no scope ticked, expiration back to 90 days. Opening it again gives a blank form.

If it does not work

NameTypeDefaultDescription
Give the key a name: it tells you where the key is used.validationThe name is empty, or only spaces. It is checked before the request is sent, so nothing was created.
Choose at least one scope.validationNo scope is ticked. A key with no scope could do nothing, so the form refuses it rather than issuing a useless key.
Portee inconnue : <scope>closed listThe server received a scope outside its closed list. This comes from an API call, not from this form, whose checkboxes cannot produce it.
Creation failedrequest failedThe request reached the server and was refused or lost. The banner reports the reason; reload the list before retrying, so a key created twice is visible.
Expiry is part of the same decision
A key with no expiration stays valid until it is revoked. If it leaks, nothing ends it on its own. Prefer 30 or 90 days unless the integration genuinely cannot be rotated.

Next

The key exists and its value is on screen, once. The next step is to copy it before it goes: Copy the key once