Authentication
To authenticate when making API requests to the Rappi API, you require an Access Token.
The Rappi API uses a Bearer authentication scheme, as the HTTP authentication method for API requests.
To make API requests, send the token in a customer header to interact with protected resources.
Rappi uses the following scheme for the Bearer authentication:
Key | Value |
---|---|
x-authorization | Bearer [access_token ] |
The following table describes the different contents of the Authentication resource:
Resource | Description |
---|---|
POST token | Use this endpoint to generate an Access Token. This token enables you to authenticate when making API requests |
POST token
Use this endpoint to generate an access token. This token enables you to authenticate when making API requests.
Endpoint URL
Use the following URLs to make a request with this endpoint:
URL: https://{NEW_DOMAIN}/restaurants/auth/oauth/token
{NEW_DOMAIN}
: This is your new Rappi Country Domain. See the list of new Country Domains.
Endpoint Properties
This resource has the following properties:
Response formats | JSON |
Request body requirements | JSON |
Parameters
This endpoint does not permit additional parameters.
Status Codes
These are the possible status codes of the response for this endpoint:
Sample Request
This is an example of an API request using this endpoint:
POST https://api.dev.rappi.com/restaurants/auth/oauth/token
This is an example of the request:
{ "client_id": "7iCfjZCO4bTns3OjqLK4de2GV3sp6Ymd", "client_secret": "40iFFYJV9A1LrVmJsaIeARW40iFFYJV9A1LrVmJsaIeARW40iFFYJV9A1LrVmJsaIeARW", "audience": "https://int-public-api-v2/api", "grant_type": "client_credentials" }
URL url = new URL("https://api.dev.rappi.com/restaurants/auth/oauth/token"); HttpURLConnection connection = (HttpURLConnection) url.openConnection(); connection.setRequestMethod("POST"); connection.setRequestProperty("User-Agent", "Mozilla/5.0"); connection.setRequestProperty("Content-Type", "application/json"); connection.setRequestProperty("Accept", "application/json"); connection.setDoOutput(true); final String jsonInputString = "{\n" + " \"client_id\":\"7iCfjZCO4bTns3OjqLK4de2GV3sp6Ymd\",\n" + " \"client_secret\":\"40iFFYJV9A1LrVmJsaIeARW40iFFYJV9A1LrVmJsaIeARW40iFFYJV9A1LrVmJsaIeARW\",\n" + " \"audience\":\"https://int-public-api-v2/api\",\n" + " \"grant_type\":\"client_credentials\"\n" + "}"; try (OutputStream os = connection.getOutputStream()) { byte[] input = jsonInputString.getBytes(StandardCharsets.UTF_8); os.write(input, 0, input.length); } try (BufferedReader br = new BufferedReader(new InputStreamReader(connection.getInputStream(), StandardCharsets.UTF_8))) { StringBuilder response = new StringBuilder(); String responseLine; while ((responseLine = br.readLine()) != null) { response.append(responseLine.trim()); } System.out.println("Response body: " + response.toString()); } System.out.println("Response Code : " + connection.getResponseCode());
This table describes the attributes that the JSON
of your request requires:
Attributes | Requirement | Description |
---|---|---|
client_id string | required | Client Id of your Rappi Credentials. |
client_secret string | required | Client Secret of your Rappi Credentials. |
audience string | required | Identifier of the Rappi API. |
grant_type string | required | Permission to request. |
Sample Response
This is an example of the response:
{ "access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpeyJhbGciOiJIUzI1NiIsInR5cCI6IkpeyJhbGciOiJIUzI1NiIsInR5cCI6Ikp", "scope": "integration:health-check", "expires_in": 86400, "token_type": "Bearer" }
This table describes the objects contained in the response example:
Response Object | Object Description |
---|---|
access_token <string | Access token to access secure endpoints. |
scope <string | Scope granted. |
expires_in <integer | Token expiration time in seconds. |
token_type <string | Token type. |