Run with Postman

Oauth

Oauth is our essential authentication web service to use our services safely. Through this service you can receive, modify and see essential tokens to access all the rest methods of the bees that we provide.

Check out more at https://developers.openapi.it/services/oauth
Explore all our services at https://developers.openapi.it/services

token

Receive, view and edit all tokens associated with your account

Receive a token

With this call passing one or more scopes you receive a token that you will need to authenticate with the same scopes you passed. Tokens with expiration dates can be very useful if you want to restrict access to just the small number of scopes that your application/service needs: in this way you can avoid unwanted requests

Authorizations:
Request Body schema: application/json
scopes
required
Array of strings 2 items

List of scopes for which you want to be authorized to use; you can also pass an asterisk as a wild card for all methods or all domains or all endpoints. For example if I want all the methods and endpoints of a given domain '*:comparabili.openapi.it/*'; if I want all the scopes '*:*/*'

expire
integer
Deprecated
Default: "<integer>"
ttl
integer
Default: "<integer>"

The token lifespan (time-to-live) in seconds, up to one year; if not provided, when creating a token it will be set to expire in 1 year from now. The example shows how to request a token that has a lifespan of 30 days.

Responses

Response Schema: application/json
scopes
Array of strings

A list of the scopes you requested, expanded

expire
integer

A UNIX timestamp, in seconds, rappresenting the expiring date of the token

token
string

Your new token

success
boolean
message
string
error
integer

Request samples

Content type
application/json
{
  • "scopes": [
    ],
  • "expire": "<integer>",
  • "ttl": 2592000
}

Response samples

Content type
application/json
{
  • "scopes": [
    ],
  • "expire": 1634223407,
  • "token": "5f8711afe4754a532a7a8358",
  • "success": true,
  • "message": "",
  • "error": null
}

List of all unexpired token

Method that returns all the tokens with their scopes still active for your account

Authorizations:
query Parameters
scope
string
Default: "<string>"
Example: scope=GET:imprese.openapi.it/base

name of the scope for which to filter the tokens

Responses

Response Schema: application/json
Array of objects[ items ]
success
boolean
message
string
error
integer

Request samples

CURL *hnd = curl_easy_init();

curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "https://test.oauth.openapi.it/token?scope=GET%3Aimprese.openapi.it%2Fbase");

struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "Authorization: Basic REPLACE_BASIC_AUTH");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);

CURLcode ret = curl_easy_perform(hnd);

Response samples

Content type
application/json
{
  • "data": [
    ],
  • "success": true,
  • "message": "",
  • "error": null
}

Finds a specific token

Method that returns the token you passed in the path

Authorizations:
path Parameters
token
required
string
Default: "<string>"
Example: 5f8041e42efdfc468b6e60ea

requested token

Responses

Response Schema: application/json
Array of objects[ items ]
success
boolean
message
string
error
integer

Request samples

CURL *hnd = curl_easy_init();

curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "https://test.oauth.openapi.it/token/5f8041e42efdfc468b6e60ea");

struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "Authorization: Basic REPLACE_BASIC_AUTH");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);

CURLcode ret = curl_easy_perform(hnd);

Response samples

Content type
application/json
{
  • "data": [
    ],
  • "success": true,
  • "message": "",
  • "error": null
}

Update the entire token object

Method that allows you to modify the entire token object by passing it new ones or the same reference scopes with a new expiration

Please note that the TTL option is not available for this method.

Authorizations:
path Parameters
token
required
string
Default: "<string>"
Example: 5f8041e42efdfc468b6e60ea

requested token

Request Body schema: application/json
scopes
required
Array of strings 2 items

List of scopes for which you want to be authorized to use; you can also pass an asterisk as a wild card for all methods or all domains or all endpoints. For example if I want all the methods and endpoints of a given domain '*:comparabili.openapi.it/*'; if I want all the scopes '*:*/*'

expire
integer
Default: "<integer>"

An expiration date in expressed as a UNIX timestamp in seconds. If not set, the date will be set one year from now

Responses

Response Schema: application/json
Array of objects[ items ]
success
boolean
message
string
error
integer

Request samples