Authentication with the SpeechKit API

To work with the SpeechKit API, you need to pass authentication. The process depends on the account type:

  1. Get an IAM token for your Yandex account, federated account, or local account.
  2. Get the ID of the folder for which your account has the ai.speechkit-stt.user, ai.speechkit-tts.user, or higher roles.
  3. When accessing SpeechKit via the API, provide the received parameters in each request:

    • For API v1 and API v2:

      Specify the IAM token in the Authorization header as follows:

      Authorization: Bearer <IAM_token>
      

      Specify the folder ID in the request body in the folderId parameter.

    • For API v3:

      • Specify the IAM token in the Authorization header.
      • Specify the folder ID in the x-folder-id header.
      Authorization: Bearer <IAM_token> 
      x-folder-id: <folder_ID>
      

SpeechKit supports two authentication methods using service accounts:

  • With an IAM token:

    1. Get an IAM token.

    2. Include the IAM token in the Authorization header in the following format:

      Authorization: Bearer <IAM_token>
      
  • With API keys.

    Use API keys if requesting an IAM token automatically is not an option.

    1. Get an API key.

    2. Include the API key in the Authorization header in the following format:

      Authorization: Api-Key <API_key>
      

Do not specify the folder ID in your requests, as the service uses the folder where your service account was created.

Useful links