Toast
API Reference

Authentication

Email+password sign-in/sign-up, magic link authentication, and session management.

POST
/api/auth/sign-up/email

Creates a new user account with email and password.

Request Body

application/json
  1. body
email*string
Formatemail
password*string
Length8 <= length
name*string

Response Body

User created and session started

application/json
  1. response
user?
session?
Example Request
curl -X POST 'https://example.com/api/auth/sign-up/email' \  -H 'Content-Type: application/json' \  -d '{  "email": "user@example.com",  "password": "stringst",  "name": "string"}'
Example Response200
{  "user": {    "id": "string",    "email": "user@example.com",    "name": "string",    "emailVerified": true  },  "session": {    "id": "string",    "expiresAt": "2019-08-24T14:15:22Z"  }}
POST
/api/auth/sign-in/email

Authenticates a user with email and password, starting a new session.

Request Body

application/json
  1. body
email*string
Formatemail
password*string

Response Body

Session started

application/json
  1. response
user?
session?
Example Request
curl -X POST 'https://example.com/api/auth/sign-in/email' \  -H 'Content-Type: application/json' \  -d '{  "email": "user@example.com",  "password": "string"}'
Example Response200
{  "user": {    "id": "string",    "email": "user@example.com",    "name": "string",    "emailVerified": true  },  "session": {    "id": "string",    "expiresAt": "2019-08-24T14:15:22Z"  }}

Sign out

POST
/api/auth/sign-out

Ends the current session.

Response Body

Session ended

application/json
  1. response
status?boolean
Example Request
curl -X POST 'https://example.com/api/auth/sign-out'
Example Response200
{  "status": true}

Get current session

GET
/api/auth/get-session

Returns the current session and user information if authenticated.

Response Body

Current session data

application/json
  1. response
user?
session?
Example Request
curl -X GET 'https://example.com/api/auth/get-session'
Example Response200
{  "user": {    "id": "string",    "email": "user@example.com",    "name": "string",    "emailVerified": true  },  "session": {    "id": "string",    "expiresAt": "2019-08-24T14:15:22Z"  }}