post https://ninjafetch.com/api/v1/auth/tokens
Recipes
🦉
NinjaEdge
Open Recipe
Request
Header
Name | Description | Example | Required |
---|---|---|---|
x-api-key | A unique key issued during onboarding | 6rprzP8q6b7ulYcLsKz2 | Yes |
Content-Type | The type of the content. By default, 'application/json' | application/json | No |
Body
The endpoint supports the generation of different tokens.
Key | Description | Example | Required |
---|---|---|---|
consumer_id | Required for widget_token generationA unique identifier of the consumer. Preferably prefixed with an abbreviation of your business name. | CN233433552 | No |
product_request_id | Required for embedded_report_token generationA unique identifier of the product request. Provided by NinjaEdge in a webhook or over API. | IBV420CE406A15E1EBF3B43 | No |
type | Type of token that will be generated. widget_token or embedded_report_token widget_token by default | widget_token | No |
consumer_id
(string)
Response
a) Access Token Issued - HTTP 200
Name | Description | Example | Type |
---|---|---|---|
access_token | A valid access token | eyJhbGciOiJIUzI1NiJ9 | String |
expires_in | The length of time in seconds that the access token is valid for. The default is one hour (3600). | 3600 | String |
message | The details of the failure | Invalid credentials | String |
b) Bad Request - HTTP 400
Name | Description | Example | Type |
---|---|---|---|
message | The details of the failure | Invalid credentials | String |
fields | Detailed error description specified by field | {...} | Object |
c) Unauthorized - HTTP 401
Name | Description | Example | Type |
---|---|---|---|
error | The details of the failure | Invalid credentials | String |
Examples for status code
{
"access_token": "eyJhbGciOiJIUzI1NiJ9.eyJjbGllbnRfaWQiOiI1NWUwNmNjMmFhMzVjZWI1ZmE1OSIsImNvbnN1bWVyX2lk
IjoiZGVtbzEyMzQifQ.lnICYcqNx3Ia5WqfifX_orvnyKW8vNjeltSnYRNvwGA",
"expires_in": 3600
}
{
"message": "Validation error",
"fields": {
"product_request_id": [
"is required for generation of embedded report token"
]
}
}
{
"error": "Invalid token"
}