Sign In
curl --request POST \
--url https://api.sublay.io/api/v6/:projectId/auth/sign-in \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"email": "<string>",
"password": "<string>"
}
'import requests
url = "https://api.sublay.io/api/v6/:projectId/auth/sign-in"
payload = {
"email": "<string>",
"password": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({email: '<string>', password: '<string>'})
};
fetch('https://api.sublay.io/api/v6/:projectId/auth/sign-in', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.sublay.io/api/v6/:projectId/auth/sign-in",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'email' => '<string>',
'password' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.sublay.io/api/v6/:projectId/auth/sign-in"
payload := strings.NewReader("{\n \"email\": \"<string>\",\n \"password\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.sublay.io/api/v6/:projectId/auth/sign-in")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"email\": \"<string>\",\n \"password\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.sublay.io/api/v6/:projectId/auth/sign-in")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"email\": \"<string>\",\n \"password\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"accessToken": "<string>",
"refreshToken": "<string>",
"user": {
"id": "<string>",
"email": "<string>",
"username": "<string>",
"name": "<string>",
"avatar": "<string>",
"bio": "<string>",
"location": {
"type": "<string>",
"coordinates": [
123
]
},
"birthdate": "<string>",
"metadata": {},
"suspensions": [
{}
],
"reputation": 123,
"createdAt": "<string>",
"updatedAt": "<string>"
}
}Auth Endpoints
Sign In
Authenticate a user using email and password
Sign In
curl --request POST \
--url https://api.sublay.io/api/v6/:projectId/auth/sign-in \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"email": "<string>",
"password": "<string>"
}
'import requests
url = "https://api.sublay.io/api/v6/:projectId/auth/sign-in"
payload = {
"email": "<string>",
"password": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({email: '<string>', password: '<string>'})
};
fetch('https://api.sublay.io/api/v6/:projectId/auth/sign-in', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.sublay.io/api/v6/:projectId/auth/sign-in",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'email' => '<string>',
'password' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.sublay.io/api/v6/:projectId/auth/sign-in"
payload := strings.NewReader("{\n \"email\": \"<string>\",\n \"password\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.sublay.io/api/v6/:projectId/auth/sign-in")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"email\": \"<string>\",\n \"password\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.sublay.io/api/v6/:projectId/auth/sign-in")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"email\": \"<string>\",\n \"password\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"accessToken": "<string>",
"refreshToken": "<string>",
"user": {
"id": "<string>",
"email": "<string>",
"username": "<string>",
"name": "<string>",
"avatar": "<string>",
"bio": "<string>",
"location": {
"type": "<string>",
"coordinates": [
123
]
},
"birthdate": "<string>",
"metadata": {},
"suspensions": [
{}
],
"reputation": 123,
"createdAt": "<string>",
"updatedAt": "<string>"
}
}Authenticate a user using email and password. Returns an access token, a refresh token, and user data.
Body Parameters
Response
Show properties
Show properties
Error Responses
Missing Fields - 400 Bad Request
Missing Fields - 400 Bad Request
{
"error": "Email, and password are required.",
"code": "auth/missing-fields"
}
User Not Found - 403 Forbidden
User Not Found - 403 Forbidden
{
"error": "User not found.",
"code": "auth/no-user-found"
}
Missing Credentials - 403 Forbidden
Missing Credentials - 403 Forbidden
{
"error": "Invalid credentials.",
"code": "auth/invalid-credentials"
}
Incorrect Password - 401 Unauthorized
Incorrect Password - 401 Unauthorized
{
"error": "Incorrect password.",
"code": "auth/wrong-password"
}
Server Error - 500 Internal Server Error
Server Error - 500 Internal Server Error
{
"error": "Internal server error.",
"code": "auth/server-error",
"details": "<Error message>"
}
Notes
- On success, an HttpOnly cookie named
replyke-refresh-jwtis set. - The
accessTokenis returned in the response body and expires in 30 minutes. - Refresh token is valid for 30 days.
- Active suspensions are included in the response user object.
- Only valid users with matching credentials can sign in.

