Authentication

API endpoints specifications

auth

Login and retrieve an authentication token

Login and retrieve an authentication token Authentication: not required

POSThttps://api.answr.space/api:auth/auth/login
Body
emailstring (email)
passwordstring
Response

Success!

Body
authTokenstring
userstring
Request
const response = await fetch('https://api.answr.space/api:auth/auth/login', {
    method: 'POST',
    headers: {
      "Content-Type": "application/json"
    },
    body: JSON.stringify({}),
});
const data = await response.json();
Response
{
  "authToken": "text",
  "user": "text"
}

Get the user record belonging to the authentication token

Get the user record belonging to the authentication token Authentication: required

GEThttps://api.answr.space/api:auth/auth/me
Authorization
Response

Success!

Body
idinteger (int64)
created_atnumber (timestamptz)
namestring
emailnullable string (email)
roleenum
adminfree-tierpaid-tier-1paid-tier-2
companystring
active_requestsinteger (int64)
Request
const response = await fetch('https://api.answr.space/api:auth/auth/me', {
    method: 'GET',
    headers: {
      "Authorization": "Bearer JWT"
    },
});
const data = await response.json();
Response
{
  "created_at": "now",
  "name": "text",
  "email": "name@gmail.com",
  "role": "admin",
  "company": "text"
}

Signup and retrieve an authentication token

Signup and retrieve an authentication token Authentication: not required

POSThttps://api.answr.space/api:auth/auth/signup
Body
name*string
email*string (email)
password*string
company*string
Response

Success!

Body
authTokenstring
userstring
Request
const response = await fetch('https://api.answr.space/api:auth/auth/signup', {
    method: 'POST',
    headers: {
      "Content-Type": "application/json"
    },
    body: JSON.stringify({
      "name": "text",
      "email": "name@gmail.com",
      "password": "text",
      "company": "text"
    }),
});
const data = await response.json();
Response
{
  "authToken": "text",
  "user": "text"
}

Last updated