Email login
curl --request POST \
--url https://staging.api.prexsell.com/v2/auth/login \
--header 'Content-Type: application/json' \
--data '
{
"email": "user@example.com",
"password": "s3cr3tP@ssword",
"companyId": "cmp_xyz789"
}
'import requests
url = "https://staging.api.prexsell.com/v2/auth/login"
payload = {
"email": "user@example.com",
"password": "s3cr3tP@ssword",
"companyId": "cmp_xyz789"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({email: 'user@example.com', password: 's3cr3tP@ssword', companyId: 'cmp_xyz789'})
};
fetch('https://staging.api.prexsell.com/v2/auth/login', 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://staging.api.prexsell.com/v2/auth/login",
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' => 'user@example.com',
'password' => 's3cr3tP@ssword',
'companyId' => 'cmp_xyz789'
]),
CURLOPT_HTTPHEADER => [
"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://staging.api.prexsell.com/v2/auth/login"
payload := strings.NewReader("{\n \"email\": \"user@example.com\",\n \"password\": \"s3cr3tP@ssword\",\n \"companyId\": \"cmp_xyz789\"\n}")
req, _ := http.NewRequest("POST", url, payload)
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://staging.api.prexsell.com/v2/auth/login")
.header("Content-Type", "application/json")
.body("{\n \"email\": \"user@example.com\",\n \"password\": \"s3cr3tP@ssword\",\n \"companyId\": \"cmp_xyz789\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://staging.api.prexsell.com/v2/auth/login")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"email\": \"user@example.com\",\n \"password\": \"s3cr3tP@ssword\",\n \"companyId\": \"cmp_xyz789\"\n}"
response = http.request(request)
puts response.read_body{
"data": {
"user": {
"id": "usr_abc123def456",
"email": "user@example.com",
"firstName": "Іван",
"lastName": "Петренко"
},
"access": {
"contextType": "COMPANY",
"companyId": "cmp_xyz789",
"partnerId": null,
"role": "ADMIN",
"company": {
"id": "cmp_xyz789",
"name": "Prexsell Bus Lines",
"slug": "prexsell-bus-lines",
"tier": "PRO"
}
},
"session": {
"id": "ses_q1w2e3r4t5",
"contextType": "COMPANY",
"companyId": "cmp_xyz789",
"userId": "usr_abc123def456",
"expiresAt": "2026-06-28T00:00:00.000Z",
"lastUsedAt": "2026-05-28T12:00:00.000Z",
"revokedAt": null
},
"availableAccesses": []
}
}{
"errors": [
{
"message": "AUTH_INVALID_CREDENTIALS",
"errorCode": "UNAUTHORIZED"
}
]
}Auth
Email login
Authenticates the user with email and password and creates a new session. Sets HTTP-only access and refresh token cookies on success.
POST
/
v2
/
auth
/
login
Email login
curl --request POST \
--url https://staging.api.prexsell.com/v2/auth/login \
--header 'Content-Type: application/json' \
--data '
{
"email": "user@example.com",
"password": "s3cr3tP@ssword",
"companyId": "cmp_xyz789"
}
'import requests
url = "https://staging.api.prexsell.com/v2/auth/login"
payload = {
"email": "user@example.com",
"password": "s3cr3tP@ssword",
"companyId": "cmp_xyz789"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({email: 'user@example.com', password: 's3cr3tP@ssword', companyId: 'cmp_xyz789'})
};
fetch('https://staging.api.prexsell.com/v2/auth/login', 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://staging.api.prexsell.com/v2/auth/login",
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' => 'user@example.com',
'password' => 's3cr3tP@ssword',
'companyId' => 'cmp_xyz789'
]),
CURLOPT_HTTPHEADER => [
"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://staging.api.prexsell.com/v2/auth/login"
payload := strings.NewReader("{\n \"email\": \"user@example.com\",\n \"password\": \"s3cr3tP@ssword\",\n \"companyId\": \"cmp_xyz789\"\n}")
req, _ := http.NewRequest("POST", url, payload)
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://staging.api.prexsell.com/v2/auth/login")
.header("Content-Type", "application/json")
.body("{\n \"email\": \"user@example.com\",\n \"password\": \"s3cr3tP@ssword\",\n \"companyId\": \"cmp_xyz789\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://staging.api.prexsell.com/v2/auth/login")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"email\": \"user@example.com\",\n \"password\": \"s3cr3tP@ssword\",\n \"companyId\": \"cmp_xyz789\"\n}"
response = http.request(request)
puts response.read_body{
"data": {
"user": {
"id": "usr_abc123def456",
"email": "user@example.com",
"firstName": "Іван",
"lastName": "Петренко"
},
"access": {
"contextType": "COMPANY",
"companyId": "cmp_xyz789",
"partnerId": null,
"role": "ADMIN",
"company": {
"id": "cmp_xyz789",
"name": "Prexsell Bus Lines",
"slug": "prexsell-bus-lines",
"tier": "PRO"
}
},
"session": {
"id": "ses_q1w2e3r4t5",
"contextType": "COMPANY",
"companyId": "cmp_xyz789",
"userId": "usr_abc123def456",
"expiresAt": "2026-06-28T00:00:00.000Z",
"lastUsedAt": "2026-05-28T12:00:00.000Z",
"revokedAt": null
},
"availableAccesses": []
}
}{
"errors": [
{
"message": "AUTH_INVALID_CREDENTIALS",
"errorCode": "UNAUTHORIZED"
}
]
}Body
application/json
Credentials and optional company context for email/password login.
Response
Successful login. Access and refresh tokens are set as HTTP-only cookies.
Full authentication payload returned after a successful login, token refresh, or session fetch.
Show child attributes
Show child attributes
⌘I
