Get Access Token

Request

Header

NameDescriptionExampleRequired
x-api-keyA unique key issued during onboarding6rprzP8q6b7ulYcLsKz2Yes
Content-TypeThe type of the content. By default, 'application/json'application/jsonNo

Body

The endpoint supports the generation of different tokens.

Key

Description

Example

Required

consumer_id

Required forwidget_token generation
A unique identifier of the consumer. Preferably prefixed with an abbreviation of your business name.

CN233433552

No

product_request_id

Required forembedded_report_token generation
A 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

NameDescriptionExampleType
messageThe details of the failureInvalid credentialsString
fieldsDetailed error description specified by field{...}Object

c) Unauthorized - HTTP 401

NameDescriptionExampleType
errorThe details of the failureInvalid credentialsString

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"
}
Language
Credentials
http
Click Try It! to start a request and see the response here!