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

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

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"  }'
{  "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

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

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

Ends the current session.

Response Body

application/json

curl -X POST "https://example.com/api/auth/sign-out"
{  "status": true}
GET
/api/auth/get-session

Returns the current session and user information if authenticated.

Response Body

application/json

curl -X GET "https://example.com/api/auth/get-session"
{  "user": {    "id": "string",    "email": "user@example.com",    "name": "string",    "emailVerified": true  },  "session": {    "id": "string",    "expiresAt": "2019-08-24T14:15:22Z"  }}