Sign in and get a token
curl --request POST \
--url https://api.cloudhumans.com/auth/v1/signin \
--header 'Content-Type: application/json' \
--data '
{
"email": "you@company.com",
"password": "••••••••"
}
'import requests
url = "https://api.cloudhumans.com/auth/v1/signin"
payload = {
"email": "you@company.com",
"password": "••••••••"
}
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: 'you@company.com', password: '••••••••'})
};
fetch('https://api.cloudhumans.com/auth/v1/signin', 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.cloudhumans.com/auth/v1/signin",
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' => 'you@company.com',
'password' => '••••••••'
]),
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://api.cloudhumans.com/auth/v1/signin"
payload := strings.NewReader("{\n \"email\": \"you@company.com\",\n \"password\": \"••••••••\"\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://api.cloudhumans.com/auth/v1/signin")
.header("Content-Type", "application/json")
.body("{\n \"email\": \"you@company.com\",\n \"password\": \"••••••••\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.cloudhumans.com/auth/v1/signin")
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\": \"you@company.com\",\n \"password\": \"••••••••\"\n}"
response = http.request(request)
puts response.read_body{
"id_token": "eyJraWQiOiJhYmMxMjMiLCJhbGciOiJSUzI1NiJ9...",
"access_token": "eyJraWQiOiJkZWY0NTYiLCJhbGciOiJSUzI1NiJ9...",
"expires_in": 3600,
"token_type": "Bearer"
}Authentication
Sign in and get a token
Authenticate with email and password and receive the token used by every other API. One token covers Claudia, Cloud Chat and the services that follow — the account you see is derived from it, and the same token is valid against production and staging.
A 200 does not always carry a token. Accounts with a temporary password, or with two-step verification turned on, come back with a challenge instead: no token yet, and a session to answer it with at POST /v1/signin/challenge. Branch on the body, not on the status — id_token present means done, challenge present means one more step.
POST
/
v1
/
signin
Sign in and get a token
curl --request POST \
--url https://api.cloudhumans.com/auth/v1/signin \
--header 'Content-Type: application/json' \
--data '
{
"email": "you@company.com",
"password": "••••••••"
}
'import requests
url = "https://api.cloudhumans.com/auth/v1/signin"
payload = {
"email": "you@company.com",
"password": "••••••••"
}
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: 'you@company.com', password: '••••••••'})
};
fetch('https://api.cloudhumans.com/auth/v1/signin', 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.cloudhumans.com/auth/v1/signin",
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' => 'you@company.com',
'password' => '••••••••'
]),
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://api.cloudhumans.com/auth/v1/signin"
payload := strings.NewReader("{\n \"email\": \"you@company.com\",\n \"password\": \"••••••••\"\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://api.cloudhumans.com/auth/v1/signin")
.header("Content-Type", "application/json")
.body("{\n \"email\": \"you@company.com\",\n \"password\": \"••••••••\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.cloudhumans.com/auth/v1/signin")
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\": \"you@company.com\",\n \"password\": \"••••••••\"\n}"
response = http.request(request)
puts response.read_body{
"id_token": "eyJraWQiOiJhYmMxMjMiLCJhbGciOiJSUzI1NiJ9...",
"access_token": "eyJraWQiOiJkZWY0NTYiLCJhbGciOiJSUzI1NiJ9...",
"expires_in": 3600,
"token_type": "Bearer"
}Body
application/json
Response
Either a token, or a challenge to answer before one is issued.
- Option 1
- Option 2
Sign-in completed.