Me Actions

https://api.losant.com/me

Below are the various requests that can be performed against the Me resource, as well as the expected parameters and the potential responses.

Add Recent Item

Adds an item to a recent item list

Method And Url

POST https://api.losant.com/me/recentItems

Authentication

A valid api access token is required to access this endpoint. The token must include at least one of the following scopes: all.User, me.*, or me.addRecentItem.

Request Headers

Name Required Description Default
Authorization Y The token for authenticating the request, prepended with Bearer

Request Body

The body of the request should be serialized JSON that validates against the Recent Item schema. For example, the following would be a valid body for this request:

{
  "itemType": "device",
  "parentId": "575ec8687ae143cd83dc4a97",
  "itemId": "575ecf887ae143cd83dc4aa2"
}

Curl Example

curl -H 'Content-Type: application/json' \
    -H 'Accept: application/json' \
    -H 'Authorization: Bearer YOUR_API_ACCESS_TOKEN' \
    -X POST \
    -d '{"itemType":"device","parentId":"575ec8687ae143cd83dc4a97","itemId":"575ecf887ae143cd83dc4aa2"}' \
    https://api.losant.com/me/recentItems

Successful Responses

Code Type Description
200 Recent Item List Updated recent item list

Error Responses

Code Type Description
400 Error Error if malformed request

Change Password

Changes the current user’s password and optionally logs out all other sessions

Method And Url

PATCH https://api.losant.com/me/changePassword

Authentication

A valid api access token is required to access this endpoint. The token must include at least one of the following scopes: all.User, me.*, or me.changePassword.

Request Headers

Name Required Description Default
Authorization Y The token for authenticating the request, prepended with Bearer

Request Body

The body of the request should be serialized JSON that validates against the Change Password schema. For example, the following would be a valid body for this request:

{
  "newPassword": "yourNewPassword1!",
  "password": "yourCurrentPassword",
  "invalidateExistingTokens": true
}

Curl Example

curl -H 'Content-Type: application/json' \
    -H 'Accept: application/json' \
    -H 'Authorization: Bearer YOUR_API_ACCESS_TOKEN' \
    -X PATCH \
    -d '{"newPassword":"yourNewPassword1!","password":"yourCurrentPassword","invalidateExistingTokens":true}' \
    https://api.losant.com/me/changePassword

Successful Responses

Code Type Description
200 Authenticated User A new, valid, auth token (potentially all previous tokens are now invalid)

Error Responses

Code Type Description
400 Error Error if malformed request

Delete

Deletes the current user

Method And Url

POST https://api.losant.com/me/delete

Authentication

A valid api access token is required to access this endpoint. The token must include at least one of the following scopes: all.User, me.*, or me.delete.

Request Headers

Name Required Description Default
Authorization Y The token for authenticating the request, prepended with Bearer

Request Body

The body of the request should be serialized JSON that validates against the User Credentials schema. For example, the following would be a valid body for this request:

{
  "email": "email@example.com",
  "password": "this is the password"
}

Curl Example

curl -H 'Content-Type: application/json' \
    -H 'Accept: application/json' \
    -H 'Authorization: Bearer YOUR_API_ACCESS_TOKEN' \
    -X POST \
    -d '{"email":"email@example.com","password":"this is the password"}' \
    https://api.losant.com/me/delete

Successful Responses

Code Type Description
200 Success If the user was successfully deleted

Error Responses

Code Type Description
400 Error Error if malformed request

Device Counts

Returns device counts by day for the time range specified for all applications the current user owns

Method And Url

GET https://api.losant.com/me/deviceCounts

Authentication

A valid api access token is required to access this endpoint. The token must include at least one of the following scopes: all.User, all.User.read, me.*, or me.deviceCounts.

Request Query Parameters

Name Required Description Default Example
start N Start of range for device count query (ms since epoch) start=0
end N End of range for device count query (ms since epoch) end=1465790400000

Request Headers

Name Required Description Default
Authorization Y The token for authenticating the request, prepended with Bearer

Curl Example

curl -H 'Content-Type: application/json' \
    -H 'Accept: application/json' \
    -H 'Authorization: Bearer YOUR_API_ACCESS_TOKEN' \
    -X GET \
    https://api.losant.com/me/deviceCounts

Successful Responses

Code Type Description
200 Device Counts Device counts by day

Error Responses

Code Type Description
400 Error Error if malformed request

Disable Two Factor Auth

Disables multi-factor authentication for the current user

Method And Url

PATCH https://api.losant.com/me/disableTwoFactorAuth

Authentication

A valid api access token is required to access this endpoint. The token must include at least one of the following scopes: all.User, me.*, or me.disableTwoFactorAuth.

Request Headers

Name Required Description Default
Authorization Y The token for authenticating the request, prepended with Bearer

Request Body

The body of the request should be serialized JSON that validates against the Disable Multi-Factor Authentication schema. For example, the following would be a valid body for this request:

{
  "twoFactorCode": "123123",
  "password": "this would be your password"
}

Curl Example

curl -H 'Content-Type: application/json' \
    -H 'Accept: application/json' \
    -H 'Authorization: Bearer YOUR_API_ACCESS_TOKEN' \
    -X PATCH \
    -d '{"twoFactorCode":"123123","password":"this would be your password"}' \
    https://api.losant.com/me/disableTwoFactorAuth

Successful Responses

Code Type Description
200 Me Updated user information

Error Responses

Code Type Description
400 Error Error if malformed request

Disconnect Github

Disconnects the user from Github

Method And Url

PATCH https://api.losant.com/me/disconnectGithub

Authentication

A valid api access token is required to access this endpoint. The token must include at least one of the following scopes: all.User, me.*, or me.disconnectGithub.

Request Headers

Name Required Description Default
Authorization Y The token for authenticating the request, prepended with Bearer

Curl Example

curl -H 'Content-Type: application/json' \
    -H 'Accept: application/json' \
    -H 'Authorization: Bearer YOUR_API_ACCESS_TOKEN' \
    -X PATCH \
    https://api.losant.com/me/disconnectGithub

Successful Responses

Code Type Description
200 Me Updated user information

Error Responses

Code Type Description
400 Error Error if malformed request

Enable Two Factor Auth

Enables multi-factor authentication for the current user

Method And Url

PATCH https://api.losant.com/me/enableTwoFactorAuth

Authentication

A valid api access token is required to access this endpoint. The token must include at least one of the following scopes: all.User, me.*, or me.enableTwoFactorAuth.

Request Headers

Name Required Description Default
Authorization Y The token for authenticating the request, prepended with Bearer

Request Body

The body of the request should be serialized JSON that validates against the Enable Multi-Factor Authentication schema. For example, the following would be a valid body for this request:

{
  "twoFactorAuthKey": "HBBGWJJVOVLXS4ZGNRTDOUKTMESFUR3BMRWVQND2HJYT44TOMVJA",
  "password": "this would be your password",
  "twoFactorCode": "012345"
}

Curl Example

curl -H 'Content-Type: application/json' \
    -H 'Accept: application/json' \
    -H 'Authorization: Bearer YOUR_API_ACCESS_TOKEN' \
    -X PATCH \
    -d '{"twoFactorAuthKey":"HBBGWJJVOVLXS4ZGNRTDOUKTMESFUR3BMRWVQND2HJYT44TOMVJA","password":"this would be your password","twoFactorCode":"012345"}' \
    https://api.losant.com/me/enableTwoFactorAuth

Successful Responses

Code Type Description
200 Me Updated user information

Error Responses

Code Type Description
400 Error Error if malformed request

Fetch Recent Items

Gets a recent item list

Method And Url

GET https://api.losant.com/me/recentItems

Authentication

A valid api access token is required to access this endpoint. The token must include at least one of the following scopes: all.User, all.User.read, me.*, or me.fetchRecentItems.

Request Query Parameters

Name Required Description Default Example
parentId N Parent id of the recent list parentId=575ec8687ae143cd83dc4a97
itemType Y Item type to get the recent list of. Accepted values are: application, device, flow, dashboard, organization itemType=application

Request Headers

Name Required Description Default
Authorization Y The token for authenticating the request, prepended with Bearer

Curl Example

curl -H 'Content-Type: application/json' \
    -H 'Accept: application/json' \
    -H 'Authorization: Bearer YOUR_API_ACCESS_TOKEN' \
    -X GET \
    https://api.losant.com/me/recentItems?itemType=application

Successful Responses

Code Type Description
200 Recent Item List Recent item list

Error Responses

Code Type Description
400 Error Error if malformed request

Generate Two Factor Auth

Returns the multi-factor authentication key for the current user

Method And Url

PATCH https://api.losant.com/me/generateTwoFactorAuth

Authentication

A valid api access token is required to access this endpoint. The token must include at least one of the following scopes: all.User, me.*, or me.generateTwoFactorAuth.

Request Headers

Name Required Description Default
Authorization Y The token for authenticating the request, prepended with Bearer

Curl Example

curl -H 'Content-Type: application/json' \
    -H 'Accept: application/json' \
    -H 'Authorization: Bearer YOUR_API_ACCESS_TOKEN' \
    -X PATCH \
    https://api.losant.com/me/generateTwoFactorAuth

Successful Responses

Code Type Description
200 Multi-Factor Authentication Info Multi-factor authentication info

Error Responses

Code Type Description
400 Error Error if malformed request

Get

Retrieves information on the current user

Method And Url

GET https://api.losant.com/me

Authentication

A valid api access token is required to access this endpoint. The token must include at least one of the following scopes: all.User, all.User.read, me.*, or me.get.

Request Query Parameters

Name Required Description Default Example
includeRecent N Should the user include recent app/dashboard info includeRecent=true
summaryExclude N Comma-separated list of summary fields to exclude from user summary summaryExclude=payloadCount
summaryInclude N Comma-separated list of summary fields to include in user summary summaryInclude=payloadCount

Request Headers

Name Required Description Default
Authorization Y The token for authenticating the request, prepended with Bearer

Curl Example

curl -H 'Content-Type: application/json' \
    -H 'Accept: application/json' \
    -H 'Authorization: Bearer YOUR_API_ACCESS_TOKEN' \
    -X GET \
    https://api.losant.com/me

Successful Responses

Code Type Description
200 Me Current user information

Error Responses

Code Type Description

Invite

Retrieves information for an invitation to an organization

Method And Url

GET https://api.losant.com/me/invites/INVITE_ID

Authentication

A valid api access token is required to access this endpoint. The token must include at least one of the following scopes: all.User, all.User.read, me.*, or me.invite.

Request Path Components

Path Component Description Example
INVITE_ID ID associated with the invitation 575ec8687ae143cd83dc4a97

Request Headers

Name Required Description Default
Authorization Y The token for authenticating the request, prepended with Bearer

Curl Example

curl -H 'Content-Type: application/json' \
    -H 'Accept: application/json' \
    -H 'Authorization: Bearer YOUR_API_ACCESS_TOKEN' \
    -X GET \
    https://api.losant.com/me/invites/INVITE_ID

Successful Responses

Code Type Description
200 Organization Invitation Information For User Information about invitation

Error Responses

Code Type Description
400 Error Error if malformed request
404 Error Error if invite not found

Invites

Retrieves pending organization invitations for a user

Method And Url

GET https://api.losant.com/me/invites

Authentication

A valid api access token is required to access this endpoint. The token must include at least one of the following scopes: all.User, all.User.read, me.*, or me.invites.

Request Headers

Name Required Description Default
Authorization Y The token for authenticating the request, prepended with Bearer

Curl Example

curl -H 'Content-Type: application/json' \
    -H 'Accept: application/json' \
    -H 'Authorization: Bearer YOUR_API_ACCESS_TOKEN' \
    -X GET \
    https://api.losant.com/me/invites

Successful Responses

Code Type Description
200 User Organization Invitations Information about invitations

Error Responses

Code Type Description
400 Error Error if malformed request

Notebook Minute Counts

Returns notebook execution usage by day for the time range specified for all applications the current user owns

Method And Url

GET https://api.losant.com/me/notebookMinuteCounts

Authentication

A valid api access token is required to access this endpoint. The token must include at least one of the following scopes: all.User, all.User.read, me.*, or me.notebookMinuteCounts.

Request Query Parameters

Name Required Description Default Example
start N Start of range for notebook execution query (ms since epoch) start=0
end N End of range for notebook execution query (ms since epoch) end=1465790400000

Request Headers

Name Required Description Default
Authorization Y The token for authenticating the request, prepended with Bearer

Curl Example

curl -H 'Content-Type: application/json' \
    -H 'Accept: application/json' \
    -H 'Authorization: Bearer YOUR_API_ACCESS_TOKEN' \
    -X GET \
    https://api.losant.com/me/notebookMinuteCounts

Successful Responses

Code Type Description
200 Notebook Minute Counts Notebook usage information

Error Responses

Code Type Description
400 Error Error if malformed request

Patch

Updates information about the current user

Method And Url

PATCH https://api.losant.com/me

Authentication

A valid api access token is required to access this endpoint. The token must include at least one of the following scopes: all.User, me.*, or me.patch.

Request Query Parameters

Name Required Description Default Example
summaryExclude N Comma-separated list of summary fields to exclude from user summary summaryExclude=payloadCount
summaryInclude N Comma-separated list of summary fields to include in user summary summaryInclude=payloadCount

Request Headers

Name Required Description Default
Authorization Y The token for authenticating the request, prepended with Bearer

Request Body

The body of the request should be serialized JSON that validates against the Me Patch schema. For example, the following would be a valid body for this request:

{
  "email": "email@example.com",
  "firstName": "Example",
  "lastName": "Name",
  "companyName": "Example, Inc.",
  "url": "https://example.com",
  "password": "My new password!!1"
}

Curl Example

curl -H 'Content-Type: application/json' \
    -H 'Accept: application/json' \
    -H 'Authorization: Bearer YOUR_API_ACCESS_TOKEN' \
    -X PATCH \
    -d '{"email":"email@example.com","firstName":"Example","lastName":"Name","companyName":"Example, Inc.","url":"https://example.com","password":"My new password!!1"}' \
    https://api.losant.com/me

Successful Responses

Code Type Description
200 Me Updated user information

Error Responses

Code Type Description
400 Error Error if malformed request

Payload Counts

Returns payload counts for the time range specified for all applications the current user owns

Method And Url

GET https://api.losant.com/me/payloadCounts

Authentication

A valid api access token is required to access this endpoint. The token must include at least one of the following scopes: all.User, all.User.read, me.*, or me.payloadCounts.

Request Query Parameters

Name Required Description Default Example
start N Start of range for payload count query (ms since epoch) start=0
end N End of range for payload count query (ms since epoch) end=1465790400000
asBytes N If the resulting stats should be returned as bytes false asBytes=true

Request Headers

Name Required Description Default
Authorization Y The token for authenticating the request, prepended with Bearer

Curl Example

curl -H 'Content-Type: application/json' \
    -H 'Accept: application/json' \
    -H 'Authorization: Bearer YOUR_API_ACCESS_TOKEN' \
    -X GET \
    https://api.losant.com/me/payloadCounts

Successful Responses

Code Type Description
200 Payload Stats Payload counts, by type and source

Error Responses

Code Type Description
400 Error Error if malformed request

Payload Counts Breakdown

Returns payload counts per resolution in the time range specified for all applications the current user owns

Method And Url

GET https://api.losant.com/me/payloadCountsBreakdown

Authentication

A valid api access token is required to access this endpoint. The token must include at least one of the following scopes: all.User, all.User.read, me.*, or me.payloadCountsBreakdown.

Request Query Parameters

Name Required Description Default Example
start N Start of range for payload count query (ms since epoch) start=0
end N End of range for payload count query (ms since epoch) end=1465790400000
resolution N Resolution in milliseconds. Accepted values are: 86400000, 3600000 86400000 resolution=86400000
asBytes N If the resulting stats should be returned as bytes false asBytes=true
includeNonBillable N If non-billable payloads should be included in the result false includeNonBillable=true

Request Headers

Name Required Description Default
Authorization Y The token for authenticating the request, prepended with Bearer

Curl Example

curl -H 'Content-Type: application/json' \
    -H 'Accept: application/json' \
    -H 'Authorization: Bearer YOUR_API_ACCESS_TOKEN' \
    -X GET \
    https://api.losant.com/me/payloadCountsBreakdown

Successful Responses

Code Type Description
200 Payload Counts Breakdown Sum of payload counts by date

Error Responses

Code Type Description
400 Error Error if malformed request

Refresh Token

Returns a new auth token based on the current auth token

Method And Url

GET https://api.losant.com/me/refreshToken

Authentication

A valid api access token is required to access this endpoint. The token must include at least one of the following scopes: all.User, or me.*.

Request Headers

Name Required Description Default
Authorization Y The token for authenticating the request, prepended with Bearer

Curl Example

curl -H 'Content-Type: application/json' \
    -H 'Accept: application/json' \
    -H 'Authorization: Bearer YOUR_API_ACCESS_TOKEN' \
    -X GET \
    https://api.losant.com/me/refreshToken

Successful Responses

Code Type Description
200 Authenticated User Successful token regeneration

Error Responses

Code Type Description
400 Error Error if malformed request
401 Error Unauthorized error if authentication fails

Respond to Invite

Accepts or rejects an invitation to an organization

Method And Url

POST https://api.losant.com/me/invites/INVITE_ID

Authentication

A valid api access token is required to access this endpoint. The token must include at least one of the following scopes: all.User, me.*, or me.respondToInvite.

Request Path Components

Path Component Description Example
INVITE_ID ID associated with the invitation 575ec8687ae143cd83dc4a97

Request Headers

Name Required Description Default
Authorization Y The token for authenticating the request, prepended with Bearer

Request Body

The body of the request should be serialized JSON that validates against the Organization Invitation Action For User schema. For example, the following would be a valid body for this request:

{
  "action": "accept"
}

Curl Example

curl -H 'Content-Type: application/json' \
    -H 'Accept: application/json' \
    -H 'Authorization: Bearer YOUR_API_ACCESS_TOKEN' \
    -X POST \
    -d '{"action":"accept"}' \
    https://api.losant.com/me/invites/INVITE_ID

Successful Responses

Code Type Description
200 Organization Invitation Result For User Acceptance or rejection of invitation

Error Responses

Code Type Description
400 Error Error if malformed request
404 Error Error if invitation not found
410 Error Error if invitation has expired

Transfer Resources

Moves resources to a new owner

Method And Url

PATCH https://api.losant.com/me/transferResources

Authentication

A valid api access token is required to access this endpoint. The token must include at least one of the following scopes: all.User, me.*, or me.transferResources.

Request Headers

Name Required Description Default
Authorization Y The token for authenticating the request, prepended with Bearer

Request Body

The body of the request should be serialized JSON that validates against the Resource Transfer schema. For example, the following would be a valid body for this request:

{
  "destinationId": "575ed6e87ae143cd83dc4aa8",
  "destinationType": "organization",
  "applicationIds": [
    "575ec8687ae143cd83dc4a97"
  ]
}

Curl Example

curl -H 'Content-Type: application/json' \
    -H 'Accept: application/json' \
    -H 'Authorization: Bearer YOUR_API_ACCESS_TOKEN' \
    -X PATCH \
    -d '{"destinationId":"575ed6e87ae143cd83dc4aa8","destinationType":"organization","applicationIds":["575ec8687ae143cd83dc4a97"]}' \
    https://api.losant.com/me/transferResources

Successful Responses

Code Type Description
200 Success If resource transfer was successful

Error Responses

Code Type Description
400 Error Error if malformed request

Verify Email

Sends an email verification to the user

Method And Url

POST https://api.losant.com/me/verify-email

Authentication

A valid api access token is required to access this endpoint. The token must include at least one of the following scopes: all.User, me.*, or me.verifyEmail.

Request Headers

Name Required Description Default
Authorization Y The token for authenticating the request, prepended with Bearer

Curl Example

curl -H 'Content-Type: application/json' \
    -H 'Accept: application/json' \
    -H 'Authorization: Bearer YOUR_API_ACCESS_TOKEN' \
    -X POST \
    https://api.losant.com/me/verify-email

Successful Responses

Code Type Description
200 Success If email verification was successfully sent

Error Responses

Code Type Description
400 Error Error if malformed request

Was this page helpful?


Still looking for help? You can also search the Losant Forums or submit your question there.