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": "34",
      "type": "sessions",
      "attributes": {
        "name": null,
        "user_id": 87,
        "token": "5f146f2d-eb82-4284-bc34-441e5c91c8e7",
        "last_ip": null,
        "location": null,
        "device": null,
        "platform": null,
        "browser": null,
        "machine": false,
        "read_only": false,
        "last_activity_at": "2021-01-24T00:03:17.944+01:00",
        "token_expires_at": null,
        "two_factor_auth": false,
        "single_sign_on": false
      },
      "relationships": {
        "user": {
          "data": {
            "type": "users",
            "id": "87"
          }
        }
      }
    }
  ],
  "included": [
    {
      "id": "87",
      "type": "users",
      "attributes": {
        "email": "user87@email.com",
        "first_name": "test first name",
        "last_name": "test last name",
        "time_zone": null,
        "avatar_url": null,
        "default_organization_id": 37,
        "default_organization_slug": "37-organization37",
        "intercom_hash": "db01f115420dfd73068cf08f8c93df30f988c067b0059eb3d61ab3ba90ca9149",
        "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
      }
    }
  ],
  "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/36

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": "40",
    "type": "sessions",
    "attributes": {
      "name": "test token",
      "user_id": 89,
      "token": "b7e53b0c-fe29-4e1c-9c91-8f5464ea75db",
      "last_ip": "127.0.0.1",
      "location": "",
      "device": null,
      "platform": null,
      "browser": "Mozilla",
      "machine": true,
      "read_only": true,
      "last_activity_at": "2021-01-24T00:03:18.098+01:00",
      "token_expires_at": null,
      "two_factor_auth": false,
      "single_sign_on": false
    },
    "relationships": {
      "user": {
        "data": {
          "type": "users",
          "id": "89"
        }
      }
    }
  },
  "included": [
    {
      "id": "89",
      "type": "users",
      "attributes": {
        "email": "user89@email.com",
        "first_name": "test first name",
        "last_name": "test last name",
        "time_zone": null,
        "avatar_url": null,
        "default_organization_id": 39,
        "default_organization_slug": "39-organization39",
        "intercom_hash": "204eb35cf0a6d43b507aa4fd56144ef0aee1014075e617ab5031c74bbf299b0a",
        "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
      }
    }
  ],
  "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": "1320",
    "type": "sessions",
    "attributes": {
      "name": null,
      "user_id": 4226,
      "token": "1a330c34-12c3-4bcd-821f-35685eb043cd",
      "last_ip": "127.0.0.1",
      "location": "",
      "device": null,
      "platform": null,
      "browser": "Mozilla",
      "machine": false,
      "read_only": false,
      "last_activity_at": "2021-01-24T00:08:29.640+01:00",
      "token_expires_at": "2021-02-07T00:08:29.640+01:00",
      "two_factor_auth": false,
      "single_sign_on": false
    },
    "relationships": {
      "user": {
        "data": {
          "type": "users",
          "id": "4226"
        }
      }
    }
  },
  "included": [
    {
      "id": "4226",
      "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": "70c46ea5ce3ff5ebed19ae89e51403b00d43184f0d761bf17eee01c355f6b69a",
        "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
      }
    }
  ],
  "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/1323/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": "377126",
      "password": "123123"
    },
    "relationships": {
      "user": {
        "data": {
          "type": "users",
          "id": "4232"
        }
      }
    }
  }
}
Responses200
Headers
Content-Type: application/vnd.api+json; charset=utf-8
Body
{
  "data": {
    "id": "1323",
    "type": "sessions",
    "attributes": {
      "name": null,
      "user_id": 4232,
      "token": "d975a7c4-580c-4570-a156-6751f236a46a",
      "last_ip": null,
      "location": null,
      "device": null,
      "platform": null,
      "browser": null,
      "machine": false,
      "read_only": false,
      "last_activity_at": "2021-01-24T00:08:30.011+01:00",
      "token_expires_at": null,
      "two_factor_auth": true,
      "single_sign_on": false
    },
    "relationships": {
      "user": {
        "data": {
          "type": "users",
          "id": "4232"
        }
      }
    }
  },
  "included": [
    {
      "id": "4232",
      "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": "a45d548ed0d8cd52287798e782d8e813fa2d623ca8d72541f69c5f405bc2eb53",
        "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
      }
    }
  ],
  "meta": {
    "settings": {}
  }
}

PUT  /api/v2/sessions/1325/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": "4234"
        }
      }
    }
  }
}
Responses200
Headers
Content-Type: application/vnd.api+json; charset=utf-8
Body
{
  "data": {
    "id": "1325",
    "type": "sessions",
    "attributes": {
      "name": null,
      "user_id": 4234,
      "token": "ad24f226-b358-4fd1-bed3-ccfaaa5bc0f3",
      "last_ip": null,
      "location": null,
      "device": null,
      "platform": null,
      "browser": null,
      "machine": false,
      "read_only": false,
      "last_activity_at": "2021-01-24T00:08:30.182+01:00",
      "token_expires_at": null,
      "two_factor_auth": true,
      "single_sign_on": false
    },
    "relationships": {
      "user": {
        "data": {
          "type": "users",
          "id": "4234"
        }
      }
    }
  },
  "included": [
    {
      "id": "4234",
      "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": "532c91a9486b39d320df7a28ddd1717563650cc4663a4fee01f9653fa8cb749c",
        "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
      }
    }
  ],
  "meta": {
    "settings": {}
  }
}

PUT  /api/v2/sessions/1327/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": "377126",
      "password": "000000"
    },
    "relationships": {
      "user": {
        "data": {
          "type": "users",
          "id": "4236"
        }
      }
    }
  }
}
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/1329/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": "4238"
        }
      }
    }
  }
}
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 23 Jan 2021