Authentication in the API Translate
The Translate API requires you to send your authentication credentials in each request. The authentication method depends on the type of account used to send your request:
-
Get an IAM token to authenticate your Yandex account or federated account. Transmit the token in the
Authorization
header of each request in the following format:Authorization: Bearer <IAM token>
-
Get the ID of any folder for which your account has the
ai.translate.user
role or higher. Make sure to include your folder ID in thefolderId
field in the body of each request.
-
Choose one of the authentication methods:
-
Get an IAM token. Include the IAM token in the
Authorization
header in the following format:Authorization: Bearer <IAM token>
-
Create an API key. Include the API key in the
Authorization
header in the following format:Authorization: Api-Key <API key>
-
-
Assign the service account the
ai.translate.user
role or higher for the folder where it was created.Do not specify the folder ID in your requests, as YandexGPT uses the folder in which the service account was created.