API Documentation

API Endpoint

Sessions

Sessions

GET /api/v2/sessions
Requestsreturns sessions

GET  /api/v2/sessions

Headers
Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
Content-Type: application/vnd.api+json
Responses200
Headers
Content-Type: application/vnd.api+json; charset=utf-8
Body
{
  "data": [
    {
      "id": "50",
      "type": "sessions",
      "attributes": {
        "name": null,
        "note": null,
        "user_id": 157,
        "token": "e818bd56-261b-451c-9108-28f250e8b3da",
        "last_ip": null,
        "location": null,
        "device": null,
        "platform": null,
        "browser": null,
        "machine": false,
        "read_only": false,
        "last_activity_at": "2021-06-16T01:03:30.301+02:00",
        "token_expires_at": null,
        "two_factor_auth": false,
        "single_sign_on": false,
        "agent_first_name": null,
        "agent_last_name": null,
        "agent_avatar": null
      },
      "relationships": {
        "user": {
          "data": {
            "type": "users",
            "id": "157"
          }
        }
      }
    }
  ],
  "included": [
    {
      "id": "157",
      "type": "users",
      "attributes": {
        "email": "user157@email.com",
        "first_name": "test first name",
        "last_name": "test last name",
        "time_zone": null,
        "avatar_url": null,
        "default_organization_id": 53,
        "default_organization_slug": "53-organization53",
        "intercom_hash": "3e007bea1b14495caea1f53fc0600fd029d76802192079a436f7724ac7083aa6",
        "beta_features": [],
        "newsletter_consent": false,
        "newsletter_consent_at": null,
        "ical_token": null,
        "preferences": null,
        "sysadmin": false,
        "sysadmin_permissions": [],
        "two_factor_auth": false,
        "sso_provision": false,
        "account_access_expires_at": null
      }
    }
  ],
  "links": {
    "first": "http://www.example.com/api/v2/sessions?page%5Bnumber%5D=1&page%5Bsize%5D=30",
    "last": "http://www.example.com/api/v2/sessions?page%5Bnumber%5D=1&page%5Bsize%5D=30"
  },
  "meta": {
    "current_page": 1,
    "total_pages": 1,
    "total_count": 1,
    "page_size": 30,
    "max_page_size": 200,
    "settings": {}
  }
}

Get all sessions
GET/api/v2/sessions


DELETE /api/v2/sessions/1
Requestsinvalidates sessionreturns userreturns error

DELETE  /api/v2/sessions/52

Headers
Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
Content-Type: application/vnd.api+json
Responses204
This response has no content.

POST  /api/v2/sessions/machine

Headers
Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
Content-Type: application/vnd.api+json
Body
{
  "data": {
    "type": "sessions",
    "attributes": {
      "name": "test token",
      "read_only": true
    }
  }
}
Responses201
Headers
Content-Type: application/vnd.api+json; charset=utf-8
Body
{
  "data": {
    "id": "56",
    "type": "sessions",
    "attributes": {
      "name": "test token",
      "note": null,
      "user_id": 159,
      "token": "277917ce-4791-4844-91a3-3b22f5df8fb9",
      "last_ip": "127.0.0.1",
      "location": "",
      "device": null,
      "platform": null,
      "browser": "Mozilla",
      "machine": true,
      "read_only": true,
      "last_activity_at": "2021-06-16T01:03:30.481+02:00",
      "token_expires_at": null,
      "two_factor_auth": false,
      "single_sign_on": false,
      "agent_first_name": null,
      "agent_last_name": null,
      "agent_avatar": null
    },
    "relationships": {
      "user": {
        "data": {
          "type": "users",
          "id": "159"
        }
      }
    }
  },
  "included": [
    {
      "id": "159",
      "type": "users",
      "attributes": {
        "email": "user159@email.com",
        "first_name": "test first name",
        "last_name": "test last name",
        "time_zone": null,
        "avatar_url": null,
        "default_organization_id": 55,
        "default_organization_slug": "55-organization55",
        "intercom_hash": "4bc6d299be4bd21d766e0f1ccace8e6131c66e806be3896a14437fbe5f199c1b",
        "beta_features": [],
        "newsletter_consent": false,
        "newsletter_consent_at": null,
        "ical_token": null,
        "preferences": null,
        "sysadmin": false,
        "sysadmin_permissions": [],
        "two_factor_auth": false,
        "sso_provision": false,
        "account_access_expires_at": null
      }
    }
  ],
  "meta": {
    "settings": {}
  }
}

POST  /api/v2/sessions/machine

Headers
Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
Content-Type: application/vnd.api+json
Body
{
  "data": {
    "type": "sessions",
    "attributes": {}
  }
}
Responses422
Headers
Content-Type: application/vnd.api+json; charset=utf-8
Body
{
  "errors": [
    {
      "status": "422",
      "code": "invalid_attribute",
      "title": "Invalid Attribute",
      "detail": "can't be blank",
      "source": {
        "pointer": "data/attributes/name"
      }
    }
  ]
}

Deletes a session
DELETE/api/v2/sessions/{id}

URI Parameters
HideShow
id
number (required) Example: 1

session id


POST /api/v2/sessions
Requestsreturns sessionreturns errorreturns error

POST  /api/v2/sessions

Headers
Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
Content-Type: application/vnd.api+json
Body
{
  "data": {
    "type": "sessions",
    "attributes": {
      "email": "login@email.com",
      "password": "123123"
    }
  }
}
Responses201
Headers
Content-Type: application/vnd.api+json; charset=utf-8
Body
{
  "data": {
    "id": "1563",
    "type": "sessions",
    "attributes": {
      "name": null,
      "note": null,
      "user_id": 4890,
      "token": "5438a036-e965-4941-8c8d-db0c6cdc09f4",
      "last_ip": "127.0.0.1",
      "location": "",
      "device": null,
      "platform": null,
      "browser": "Mozilla",
      "machine": false,
      "read_only": false,
      "last_activity_at": "2021-06-16T01:10:48.843+02:00",
      "token_expires_at": "2021-06-30T01:10:48.843+02:00",
      "two_factor_auth": false,
      "single_sign_on": false,
      "agent_first_name": null,
      "agent_last_name": null,
      "agent_avatar": null
    },
    "relationships": {
      "user": {
        "data": {
          "type": "users",
          "id": "4890"
        }
      }
    }
  },
  "included": [
    {
      "id": "4890",
      "type": "users",
      "attributes": {
        "email": "login@email.com",
        "first_name": "test first name",
        "last_name": "test last name",
        "time_zone": null,
        "avatar_url": null,
        "default_organization_id": null,
        "default_organization_slug": null,
        "intercom_hash": "35016600b6d02f80748b3d0f9505e0eb5c5bd2b9d8e80ecac3443d65af767c85",
        "beta_features": [],
        "newsletter_consent": false,
        "newsletter_consent_at": null,
        "ical_token": null,
        "preferences": null,
        "sysadmin": false,
        "sysadmin_permissions": [],
        "two_factor_auth": false,
        "sso_provision": false,
        "account_access_expires_at": null
      }
    }
  ],
  "meta": {
    "settings": {}
  }
}

POST  /api/v2/sessions

Headers
Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
Content-Type: application/vnd.api+json
Body
{
  "data": {
    "type": "sessions",
    "attributes": {
      "email": "login@email.com",
      "password": "aaa"
    }
  }
}
Responses401
Headers
Content-Type: application/vnd.api+json; charset=utf-8
Body
{
  "errors": [
    {
      "status": "401",
      "code": "invalid_auth_token",
      "title": "Unauthenticated",
      "detail": "You are not authenticated",
      "source": {
        "pointer": null
      }
    }
  ]
}

POST  /api/v2/sessions

Headers
Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
Content-Type: application/vnd.api+json
Body
{
  "data": {
    "type": "sessions",
    "attributes": {
      "email": "login+invalid@email.com",
      "password": "123123"
    }
  }
}
Responses401
Headers
Content-Type: application/vnd.api+json; charset=utf-8
Body
{
  "errors": [
    {
      "status": "401",
      "code": "invalid_auth_token",
      "title": "Unauthenticated",
      "detail": "You are not authenticated",
      "source": {
        "pointer": null
      }
    }
  ]
}

Create a session
POST/api/v2/sessions

URI Parameters
HideShow
email
string (required) Example: user%40mail.com

email

password
string (required) Example: 123

password


PUT /api/v2/sessions/1/validate_otp
Requestsupdates sessionupdates sessionreturns errorreturns error

PUT  /api/v2/sessions/1566/validate_otp

Headers
Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
Content-Type: application/vnd.api+json
Body
{
  "data": {
    "type": "sessions",
    "attributes": {
      "otp": "108009",
      "password": "123123"
    },
    "relationships": {
      "user": {
        "data": {
          "type": "users",
          "id": "4896"
        }
      }
    }
  }
}
Responses200
Headers
Content-Type: application/vnd.api+json; charset=utf-8
Body
{
  "data": {
    "id": "1566",
    "type": "sessions",
    "attributes": {
      "name": null,
      "note": null,
      "user_id": 4896,
      "token": "43c13d61-a3a4-4dc1-b7c7-2debf34569d4",
      "last_ip": null,
      "location": null,
      "device": null,
      "platform": null,
      "browser": null,
      "machine": false,
      "read_only": false,
      "last_activity_at": "2021-06-16T01:10:49.304+02:00",
      "token_expires_at": null,
      "two_factor_auth": true,
      "single_sign_on": false,
      "agent_first_name": null,
      "agent_last_name": null,
      "agent_avatar": null
    },
    "relationships": {
      "user": {
        "data": {
          "type": "users",
          "id": "4896"
        }
      }
    }
  },
  "included": [
    {
      "id": "4896",
      "type": "users",
      "attributes": {
        "email": "login@email.com",
        "first_name": "test first name",
        "last_name": "test last name",
        "time_zone": null,
        "avatar_url": null,
        "default_organization_id": null,
        "default_organization_slug": null,
        "intercom_hash": "743256b40bf2723d122e7e15921951071941d70f92493ed788027cec5302b890",
        "beta_features": [],
        "newsletter_consent": false,
        "newsletter_consent_at": null,
        "ical_token": null,
        "preferences": null,
        "sysadmin": false,
        "sysadmin_permissions": [],
        "two_factor_auth": false,
        "sso_provision": false,
        "account_access_expires_at": null
      }
    }
  ],
  "meta": {
    "settings": {}
  }
}

PUT  /api/v2/sessions/1568/validate_otp

Headers
Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
Content-Type: application/vnd.api+json
Body
{
  "data": {
    "type": "sessions",
    "attributes": {
      "otp": "abcdefgh",
      "password": "123123"
    },
    "relationships": {
      "user": {
        "data": {
          "type": "users",
          "id": "4898"
        }
      }
    }
  }
}
Responses200
Headers
Content-Type: application/vnd.api+json; charset=utf-8
Body
{
  "data": {
    "id": "1568",
    "type": "sessions",
    "attributes": {
      "name": null,
      "note": null,
      "user_id": 4898,
      "token": "1b6f00b9-bd85-4222-9a16-16b40b219d55",
      "last_ip": null,
      "location": null,
      "device": null,
      "platform": null,
      "browser": null,
      "machine": false,
      "read_only": false,
      "last_activity_at": "2021-06-16T01:10:49.531+02:00",
      "token_expires_at": null,
      "two_factor_auth": true,
      "single_sign_on": false,
      "agent_first_name": null,
      "agent_last_name": null,
      "agent_avatar": null
    },
    "relationships": {
      "user": {
        "data": {
          "type": "users",
          "id": "4898"
        }
      }
    }
  },
  "included": [
    {
      "id": "4898",
      "type": "users",
      "attributes": {
        "email": "login@email.com",
        "first_name": "test first name",
        "last_name": "test last name",
        "time_zone": null,
        "avatar_url": null,
        "default_organization_id": null,
        "default_organization_slug": null,
        "intercom_hash": "562dc3cf7bf8bda18ea37000378bc7e5d1cf08b58e90ecaf3a87ec2919494ba5",
        "beta_features": [],
        "newsletter_consent": false,
        "newsletter_consent_at": null,
        "ical_token": null,
        "preferences": null,
        "sysadmin": false,
        "sysadmin_permissions": [],
        "two_factor_auth": false,
        "sso_provision": false,
        "account_access_expires_at": null
      }
    }
  ],
  "meta": {
    "settings": {}
  }
}

PUT  /api/v2/sessions/1570/validate_otp

Headers
Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
Content-Type: application/vnd.api+json
Body
{
  "data": {
    "type": "sessions",
    "attributes": {
      "otp": "108009",
      "password": "000000"
    },
    "relationships": {
      "user": {
        "data": {
          "type": "users",
          "id": "4900"
        }
      }
    }
  }
}
Responses401
Headers
Content-Type: application/vnd.api+json; charset=utf-8
Body
{
  "errors": [
    {
      "status": "401",
      "code": "invalid_auth_token",
      "title": "Unauthenticated",
      "detail": "You are not authenticated",
      "source": {
        "pointer": null
      }
    }
  ]
}

PUT  /api/v2/sessions/1572/validate_otp

Headers
Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
Content-Type: application/vnd.api+json
Body
{
  "data": {
    "type": "sessions",
    "attributes": {
      "otp": "000000",
      "password": "123123"
    },
    "relationships": {
      "user": {
        "data": {
          "type": "users",
          "id": "4902"
        }
      }
    }
  }
}
Responses422
Headers
Content-Type: application/vnd.api+json; charset=utf-8
Body
{
  "errors": [
    {
      "status": "422",
      "code": "invalid_attribute",
      "title": "Invalid Attribute",
      "detail": "attribute is invalid",
      "source": {
        "pointer": "data/attributes/otp"
      }
    }
  ]
}

Validates s session
PUT/api/v2/sessions/{id}/validate_otp

URI Parameters
HideShow
id
number (required) Example: 1

session id

password
string (required) Example: 123

password

otp
string (required) Example: abc

otp

user_id: `1` (number, required) - user_id
string (required) 

Generated by aglio on 15 Jun 2021