Sign in
curl --request POST \
--url https://api.hi-doctor.ai/v1/users/token/ \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'X-Brand-Slug: <x-brand-slug>' \
--data '
{
"email": "patient@example.com",
"password": "a-strong-password"
}
'import requests
url = "https://api.hi-doctor.ai/v1/users/token/"
payload = {
"email": "patient@example.com",
"password": "a-strong-password"
}
headers = {
"X-Brand-Slug": "<x-brand-slug>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'X-Brand-Slug': '<x-brand-slug>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({email: 'patient@example.com', password: 'a-strong-password'})
};
fetch('https://api.hi-doctor.ai/v1/users/token/', 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.hi-doctor.ai/v1/users/token/",
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' => 'patient@example.com',
'password' => 'a-strong-password'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"X-Brand-Slug: <x-brand-slug>"
],
]);
$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.hi-doctor.ai/v1/users/token/"
payload := strings.NewReader("{\n \"email\": \"patient@example.com\",\n \"password\": \"a-strong-password\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-Brand-Slug", "<x-brand-slug>")
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.hi-doctor.ai/v1/users/token/")
.header("X-Brand-Slug", "<x-brand-slug>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"email\": \"patient@example.com\",\n \"password\": \"a-strong-password\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.hi-doctor.ai/v1/users/token/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-Brand-Slug"] = '<x-brand-slug>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"email\": \"patient@example.com\",\n \"password\": \"a-strong-password\"\n}"
response = http.request(request)
puts response.read_body{
"refresh": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ0b2tlbl90eXBlIjoicmVmcmVzaCJ9.9Xb2mQ4dLo",
"access": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ0b2tlbl90eXBlIjoiYWNjZXNzIn0.Ksn1w0K6iQ",
"is_doctor": false,
"is_backoffice_admin": false,
"is_marketer": false
}{
"error": "This account uses Google sign-in",
"code": "google_account"
}{
"error": "Invalid credentials",
"code": "invalid_credentials"
}{
"error": "This account is inactive",
"code": "user_inactive"
}Account
Sign in
Exchange an email and password for an access and refresh token pair.
Requires the X-Brand-Slug: hi-doctor header. Sign-in itself needs no bearer token.
An account created through Google sign-in has no password and is refused with code: "google_account" — offer Continue with Google rather than an invalid-credentials message, which reads to the patient as though their account is gone.
POST
/
v1
/
users
/
token
/
Sign in
curl --request POST \
--url https://api.hi-doctor.ai/v1/users/token/ \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'X-Brand-Slug: <x-brand-slug>' \
--data '
{
"email": "patient@example.com",
"password": "a-strong-password"
}
'import requests
url = "https://api.hi-doctor.ai/v1/users/token/"
payload = {
"email": "patient@example.com",
"password": "a-strong-password"
}
headers = {
"X-Brand-Slug": "<x-brand-slug>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'X-Brand-Slug': '<x-brand-slug>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({email: 'patient@example.com', password: 'a-strong-password'})
};
fetch('https://api.hi-doctor.ai/v1/users/token/', 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.hi-doctor.ai/v1/users/token/",
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' => 'patient@example.com',
'password' => 'a-strong-password'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"X-Brand-Slug: <x-brand-slug>"
],
]);
$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.hi-doctor.ai/v1/users/token/"
payload := strings.NewReader("{\n \"email\": \"patient@example.com\",\n \"password\": \"a-strong-password\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-Brand-Slug", "<x-brand-slug>")
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.hi-doctor.ai/v1/users/token/")
.header("X-Brand-Slug", "<x-brand-slug>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"email\": \"patient@example.com\",\n \"password\": \"a-strong-password\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.hi-doctor.ai/v1/users/token/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-Brand-Slug"] = '<x-brand-slug>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"email\": \"patient@example.com\",\n \"password\": \"a-strong-password\"\n}"
response = http.request(request)
puts response.read_body{
"refresh": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ0b2tlbl90eXBlIjoicmVmcmVzaCJ9.9Xb2mQ4dLo",
"access": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ0b2tlbl90eXBlIjoiYWNjZXNzIn0.Ksn1w0K6iQ",
"is_doctor": false,
"is_backoffice_admin": false,
"is_marketer": false
}{
"error": "This account uses Google sign-in",
"code": "google_account"
}{
"error": "Invalid credentials",
"code": "invalid_credentials"
}{
"error": "This account is inactive",
"code": "user_inactive"
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Headers
Identifies the Hi-Doctor brand. Required; the request is rejected without it.
Available options:
hi-doctor Body
application/json
Response
Token pair returned by sign-in, with the role flags the web app uses for routing. All three are false on a patient account and none of them grants access to anything in this reference.