Access Token

This endpoint creates a new Access Token

Request

To create a new Access Token, please make a POST request to the following URL:

HTTP MethodURL
POSThttps://industrial.api.ubidots.com/o/token

Key Parameters

KeyTypeValueRequired?Description
grant_typeStringpasswordYesThe grant authorization type
usernameString-YesThe username of the user wheater an end user or the owner
passwordString-YesThe password of the user wheater an end user or the owner
audienceString-NoYour API identifier
scopeStringread:writeYesThe scope of the authentication, it could be for read or write purposes
client_idString-YesThe client ID of your account
client_secretString-YesThe client secret of your account

🚧

Client ID and Client Secret

You must request the client_id and client_secret to the technical Ubidots team. Please send this request to the following e-mail: [email protected]

Header

ParameterTypeDescription
Content-TypeString(application/x-www-form-urlencoded)Content type of keys
curl --location --request POST 'https://industrial.api.ubidots.com/o/token/' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data 'grant_type=password' \
--data 'username=check' \
--data 'password=75904268leo' \
--data 'scope=read write' \
--data 'client_id=CNpL7wnnnBdTp8uUNKDK5KjT8cV28TA6wOu4Psst' \
--data 'client_secret=TC8B8vSeVNCOuMyGIZ4Pmxjf52c8dPyteJRVjxxai5SIpNmI0APluWHBr0XLzs6i6GGAN5cViY7DnzqypKcetaq8Msky9hOeHYu46C96hgIfldqpo5IVWQJ2M57KEHhe'
{
  "access_token": "UmXZ6WavsakMLtaIQ7P9p9y0M1HBSs",
  "expires_in": 36000,
  "token_type": "Bearer",
  "scope": "read write",
  "refresh_token": "aFcDvEmm0zDjJd4vcSE9AtMlIcnpoP"
}
{
  "error": "invalid_grant",
  "error_description": "Invalid credentials given."
}

Returns an Object containing the oAuth2 session.

📘

List of endpoints available with Auth2

/v2.0/devices/
/v2.0/devices/<device_key>/
/v2.0/devices/<device_key>/variables/

/v2.0/variables/
/v2.0/variables/<variable_key>/

/v1.6/variables/<variable_key>/values

/api/v2.0/users/
/api/v2.0/users/<user_key>

Header

ParameterTypeDescription
Content-TypeString(application/json)Content type of body
Authorization: BearerStringAccess Token
curl --request GET \
--url 'https://industrial.api.ubidots.com/api/v2.0/devices/' \
-H 'Authorization: Bearer cBBLtgOhfYImGiH47QLG1OTKjtqDd0'\
{
  "count": 1,
  "next": null,
  "previous": null,
  "results": [
    {
      "url": "https://industrial.api.ubidots.com/api/v2.0/devices/639a820378b2b3000cd18c0e",
      "id": "639a820378b2b3000cd18c0e",
      "organization": {
        "url": "https://industrial.api.ubidots.com/api/v2.0/organizations/62b4eb3519cd98007bf410bf",
        "id": "62b4eb3519cd98007bf410bf",
        "label": "my-third-customer",
        "name": "Cliente1",
        "createdAt": "2022-06-23T22:37:41.840643Z"
      },
      "label": "xbee",
      "name": "xbee",
      "description": "",
      "tags": [],
      "properties": {},
      "isActive": true,
      "lastActivity": 1671110138954,
      "createdAt": "2022-12-15T02:10:11.432971Z",
      "variables": "https://industrial.api.ubidots.com/api/v2.0/devices/639a820378b2b3000cd18c0e/variables",
      "variablesCount": 1
    }
  ]
}
{
  "code": 401002,
  "message": "Incorrect authentication credentials."
}

Returns an object with the requested endpoint.