> For the complete documentation index, see [llms.txt](https://doc-api.blurit.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://doc-api.blurit.io/api-v1/using-the-api-v1/api-documentation/authentication.md).

# Authentication

## Authenticate to the API

> Authenticate to the API using your client credentials. Returns a token needed for all other routes.

```json
{"openapi":"3.0.1","info":{"title":"Wassa Innovation Services API","version":"1.0.0"},"servers":[{"url":"https://api.services.wassa.io"}],"security":[],"paths":{"/login":{"post":{"tags":["Authentication"],"summary":"Authenticate to the API","description":"Authenticate to the API using your client credentials. Returns a token needed for all other routes.","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/LoginRequest"}}}},"responses":{"200":{"description":"Successfully authenticated","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LoginResponse"}}}},"400":{"description":"Bad Request - Invalid parameters","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error400"}}}},"401":{"description":"Invalid credentials","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error401"}}}}}}}},"components":{"schemas":{"LoginRequest":{"type":"object","required":["clientId","secretId"],"properties":{"clientId":{"type":"string","description":"Client Id available in the Developer Account section"},"secretId":{"type":"string","description":"Secret ID available in the Developer Account section"}}},"LoginResponse":{"type":"object","required":["token","refreshToken","expiresIn"],"properties":{"token":{"type":"string","description":"JWT token for authentication"},"refreshToken":{"type":"string","description":"Token used to refresh the JWT token"},"expiresIn":{"type":"integer","format":"int32","description":"Token expiration time in seconds"}}},"Error400":{"allOf":[{"$ref":"#/components/schemas/BaseErrorResponse"}]},"BaseErrorResponse":{"type":"object","properties":{"error":{"type":"string","description":"Error message"},"code":{"type":"string","description":"Error code"}}},"Error401":{"allOf":[{"$ref":"#/components/schemas/BaseErrorResponse"}]}}}}
```

## Refresh access token

> Refresh an expired access token using the refresh token. The Bearer token can be expired.

```json
{"openapi":"3.0.1","info":{"title":"Wassa Innovation Services API","version":"1.0.0"},"servers":[{"url":"https://api.services.wassa.io"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT","description":"JWT token needed for all other routes. The token acquired with the login route."}},"schemas":{"TokenRequest":{"type":"object","required":["refreshToken"],"properties":{"refreshToken":{"type":"string","description":"Refresh token received from login"}}},"TokenResponse":{"type":"object","required":["token","refreshToken","expiresIn"],"properties":{"token":{"type":"string","description":"New JWT token"},"refreshToken":{"type":"string","description":"New refresh token"},"expiresIn":{"type":"integer","format":"int32","description":"Token expiration time in seconds"}}},"Error400":{"allOf":[{"$ref":"#/components/schemas/BaseErrorResponse"}]},"BaseErrorResponse":{"type":"object","properties":{"error":{"type":"string","description":"Error message"},"code":{"type":"string","description":"Error code"}}},"Error401":{"allOf":[{"$ref":"#/components/schemas/BaseErrorResponse"}]},"Error403":{"allOf":[{"$ref":"#/components/schemas/BaseErrorResponse"}]}}},"paths":{"/token":{"post":{"tags":["Authentication"],"summary":"Refresh access token","description":"Refresh an expired access token using the refresh token. The Bearer token can be expired.","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TokenRequest"}}}},"responses":{"200":{"description":"Token successfully refreshed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TokenResponse"}}}},"400":{"description":"Bad Request - Invalid parameters","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error400"}}}},"401":{"description":"Unauthorized - Invalid token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error401"}}}},"403":{"description":"Forbidden - Insufficient permissions","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error403"}}}}}}}}}
```
