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": "58",
      "type": "sessions",
      "attributes": {
        "name": null,
        "note": null,
        "user_id": 119,
        "token": "b956ec98-5ccb-4507-8778-ee096d595f64",
        "last_ip": null,
        "location": null,
        "device": null,
        "platform": null,
        "browser": null,
        "machine": false,
        "read_only": false,
        "last_activity_at": "2025-07-24T06:03:32.927+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": {
          "meta": {
            "included": false
          }
        }
      }
    }
  ],
  "links": {
    "first": "http://api-test.productive.io/api/v2/sessions?page%5Bnumber%5D=1&page%5Bsize%5D=30",
    "last": "http://api-test.productive.io/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
  }
}

Get all sessions
GET/api/v2/sessions


DELETE /api/v2/sessions/1
Requestsinvalidates sessionreturns userreturns errorreturns jwt token and payload

DELETE  /api/v2/sessions/60

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": "68",
    "type": "sessions",
    "attributes": {
      "name": "test token",
      "note": null,
      "user_id": 123,
      "token": "6b266034-fd25-4544-995c-d6efd329588b",
      "last_ip": "127.0.0.1",
      "location": "",
      "device": null,
      "platform": null,
      "browser": "Mozilla",
      "machine": true,
      "read_only": true,
      "last_activity_at": "2025-07-24T06:03:33.063+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": {
        "meta": {
          "included": false
        }
      }
    }
  },
  "meta": {}
}

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"
      }
    }
  ]
}

POST  /api/v2/sessions/jwt?expires_in=60

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
Responses201
Headers
Content-Type: application/json; charset=utf-8
Body
{
  "jwt": "eyJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoxMjksImV4cCI6MTc1MzMyOTg3MywidHlwZSI6InJlYWQtb25seSJ9.UW_iYUyxPybgc4Ti0uG9b3vbslUUaAnEuxpi6zGgaVA",
  "payload": {
    "user_id": 129,
    "exp": 1753329873,
    "type": "read-only"
  }
}

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

URI Parameters
HideShow
id
number (required) Example: 1

session id


POST /api/v2/sessions
Requestsreturns session when email found and password matchingreturns error when password not matchingreturns error when email not found

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": "2201",
    "type": "sessions",
    "attributes": {
      "name": null,
      "note": null,
      "user_id": 7685,
      "token": "1a7ea4b1-1b43-4178-9953-ef6f956a36c8",
      "last_ip": "127.0.0.1",
      "location": "",
      "device": null,
      "platform": null,
      "browser": "Mozilla",
      "machine": false,
      "read_only": false,
      "last_activity_at": "2025-07-24T06:16:25.156+02:00",
      "token_expires_at": "2025-08-07T06:16:25.156+02:00",
      "two_factor_auth": false,
      "single_sign_on": false,
      "agent_first_name": null,
      "agent_last_name": null,
      "agent_avatar": null
    },
    "relationships": {
      "user": {
        "meta": {
          "included": false
        }
      }
    }
  },
  "meta": {}
}

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": {}
    }
  ]
}

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": {}
    }
  ]
}

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 session when password matching and otp validupdates session when password matching and valid recovery codereturns error when password not matching and otp validreturns error when password matching and otp invalid

PUT  /api/v2/sessions/2207/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": "308848",
      "password": "123123"
    },
    "relationships": {
      "user": {
        "data": {
          "type": "users",
          "id": "7700"
        }
      }
    }
  }
}
Responses200
Headers
Content-Type: application/vnd.api+json; charset=utf-8
Body
{
  "data": {
    "id": "2207",
    "type": "sessions",
    "attributes": {
      "name": null,
      "note": null,
      "user_id": 7700,
      "token": "d0dd9a44-bb13-4e34-8e5c-157ba6839867",
      "last_ip": null,
      "location": null,
      "device": null,
      "platform": null,
      "browser": null,
      "machine": false,
      "read_only": false,
      "last_activity_at": "2025-07-24T06:16:25.756+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": {
        "meta": {
          "included": false
        }
      }
    }
  },
  "meta": {}
}

PUT  /api/v2/sessions/2209/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": "7703"
        }
      }
    }
  }
}
Responses200
Headers
Content-Type: application/vnd.api+json; charset=utf-8
Body
{
  "data": {
    "id": "2209",
    "type": "sessions",
    "attributes": {
      "name": null,
      "note": null,
      "user_id": 7703,
      "token": "57a4b66c-a29d-4b08-b547-4d64be8a07c0",
      "last_ip": null,
      "location": null,
      "device": null,
      "platform": null,
      "browser": null,
      "machine": false,
      "read_only": false,
      "last_activity_at": "2025-07-24T06:16:25.889+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": {
        "meta": {
          "included": false
        }
      }
    }
  },
  "meta": {}
}

PUT  /api/v2/sessions/2211/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": "308848",
      "password": "000000"
    },
    "relationships": {
      "user": {
        "data": {
          "type": "users",
          "id": "7706"
        }
      }
    }
  }
}
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": {}
    }
  ]
}

PUT  /api/v2/sessions/2213/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": "7709"
        }
      }
    }
  }
}
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 24 Jul 2025