Create a session
Endpoint: Create Session
POST /api/sessions
/api/sessions
This endpoint is used to create a new session for a device using a unique identifier. The response includes a token that can be used for subsequent authenticated requests.
Request
Endpoint:
/api/sessions
Method: POST
Content-Type:
application/json
Request Body
The request body should be a JSON object containing the following field:
Fields:
identifier:
string
(Required) - The unique identifier associated with the device or session. This could be a device ID or any unique identifier that the system uses to track sessions.
Example Request
Response
200 OK: The request was successful, and a session token is returned in the response body.
Response Body:
Node.js (Axios) Example Code
Response Details
token:
string
- The session token that will be used for authenticating future API requests.
Use Cases
Session Management: Use this endpoint to create a new session for a device or user, which can then be used to authenticate subsequent API requests.
Token-Based Authentication: The token provided in the response can be included in the Authorization header for other API requests to authenticate the user or device.
Error Handling
400 Bad Request: Returned if the
identifier
is missing or invalid.500 Internal Server Error: Returned if there is an issue on the server side while processing the request.
Example Response
Last updated