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": "42",
      "type": "sessions",
      "attributes": {
        "name": null,
        "note": null,
        "user_id": 122,
        "token": "b6bd3f48-caa0-4e02-a84d-1a9a7d47b4a9",
        "last_ip": null,
        "location": null,
        "device": null,
        "platform": null,
        "browser": null,
        "machine": false,
        "read_only": false,
        "last_activity_at": "2021-04-15T01:02:51.758+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": "122"
          }
        }
      }
    }
  ],
  "included": [
    {
      "id": "122",
      "type": "users",
      "attributes": {
        "email": "user122@email.com",
        "first_name": "test first name",
        "last_name": "test last name",
        "time_zone": null,
        "avatar_url": null,
        "default_organization_id": 45,
        "default_organization_slug": "45-organization45",
        "intercom_hash": "675caabb5c7f707fa22b8585a9397438239692c9f4aae60efddf9f37abe41f1a",
        "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/44

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": "48",
    "type": "sessions",
    "attributes": {
      "name": "test token",
      "note": null,
      "user_id": 124,
      "token": "d4aaa0fd-8ffb-41d1-b70e-0225beabc8ca",
      "last_ip": "127.0.0.1",
      "location": "",
      "device": null,
      "platform": null,
      "browser": "Mozilla",
      "machine": true,
      "read_only": true,
      "last_activity_at": "2021-04-15T01:02:51.917+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": "124"
        }
      }
    }
  },
  "included": [
    {
      "id": "124",
      "type": "users",
      "attributes": {
        "email": "user124@email.com",
        "first_name": "test first name",
        "last_name": "test last name",
        "time_zone": null,
        "avatar_url": null,
        "default_organization_id": 47,
        "default_organization_slug": "47-organization47",
        "intercom_hash": "9d3ffaeb7d89a80f892fcf2397f5597ed5ad4c50d0d89213ba62186fccbd915a",
        "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": "1392",
    "type": "sessions",
    "attributes": {
      "name": null,
      "note": null,
      "user_id": 4582,
      "token": "cc79a494-fb2f-4f97-a235-946327026ae2",
      "last_ip": "127.0.0.1",
      "location": "",
      "device": null,
      "platform": null,
      "browser": "Mozilla",
      "machine": false,
      "read_only": false,
      "last_activity_at": "2021-04-15T01:08:53.521+02:00",
      "token_expires_at": "2021-04-29T01:08:53.521+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": "4582"
        }
      }
    }
  },
  "included": [
    {
      "id": "4582",
      "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": "368753d420ae73dc84beb726712f25dbbb835b18241f1edfc41905a8254c1df1",
        "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/1395/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": "685878",
      "password": "123123"
    },
    "relationships": {
      "user": {
        "data": {
          "type": "users",
          "id": "4588"
        }
      }
    }
  }
}
Responses200
Headers
Content-Type: application/vnd.api+json; charset=utf-8
Body
{
  "data": {
    "id": "1395",
    "type": "sessions",
    "attributes": {
      "name": null,
      "note": null,
      "user_id": 4588,
      "token": "01169ab0-7673-4027-971a-40f1571ac8a6",
      "last_ip": null,
      "location": null,
      "device": null,
      "platform": null,
      "browser": null,
      "machine": false,
      "read_only": false,
      "last_activity_at": "2021-04-15T01:08:53.929+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": "4588"
        }
      }
    }
  },
  "included": [
    {
      "id": "4588",
      "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": "3e9398ae7e6cbb8cef7402f227472e384c5cfe28e69edb8293a63bd8050abed9",
        "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/1397/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": "4590"
        }
      }
    }
  }
}
Responses200
Headers
Content-Type: application/vnd.api+json; charset=utf-8
Body
{
  "data": {
    "id": "1397",
    "type": "sessions",
    "attributes": {
      "name": null,
      "note": null,
      "user_id": 4590,
      "token": "7dca7bc6-3943-4159-8608-e30a5bad013d",
      "last_ip": null,
      "location": null,
      "device": null,
      "platform": null,
      "browser": null,
      "machine": false,
      "read_only": false,
      "last_activity_at": "2021-04-15T01:08:54.105+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": "4590"
        }
      }
    }
  },
  "included": [
    {
      "id": "4590",
      "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": "343983453a49e9af0d2f89fd4942cc6625e68f2473f02f103daafbab71ef9581",
        "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/1399/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": "685878",
      "password": "000000"
    },
    "relationships": {
      "user": {
        "data": {
          "type": "users",
          "id": "4592"
        }
      }
    }
  }
}
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/1401/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": "4594"
        }
      }
    }
  }
}
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 14 Apr 2021