We use OAuth2 authentication process with next configuration:

auth-type: client-credentials
token0endpoint: https://rask-prod.auth.us-east-2.amazoncognito.com/oauth2/token
request-type: basic
scopes: 
    - api/source 
    - api/input 
    - api/output 
    - api/limit

1. Postman

Authentication with Postman can be done by following the steps below:

  1. On Authorization tab choose OAuth 2.0 as Auth Type
  2. In Configure New Token section use the following values:
Token Name: Rask API Token
Grant type: Client Credentials
Access Token URL: https://rask-prod.auth.us-east-2.amazoncognito.com/oauth2/token
Client ID: ${YOUR_CLIENT_ID}
Client Secret: ${YOUR_CLIENT_SECRET}
Scope: api/source api/input api/output api/limit
Client Authentication: Send as Basic Auth header
  1. Click Get New Access Token -> Proceed -> Use Token

2. Python

You can also use python along with authlib and httpx. See the following example:

import asyncio

from authlib.integrations.httpx_client import AsyncOAuth2Client


async def main():
    client = AsyncOAuth2Client(
        f"{YOUR_CLIENT_ID}",
        f"{YOUR_CLIENT_SECRET}",
        token_endpoint_auth_method="client_secret_post",
        grant_type="client_credentials",
        scope=["api/source", "api/input", "api/output", "api/limit"],
        token_endpoint="https://rask-prod.auth.us-east-2.amazoncognito.com/oauth2/token",
    )
    await client.fetch_token()
    res = await client.get("https://api.rask.ai/v2/credits")
    print(res.json())


if __name__ == "__main__":
    asyncio.run(main())