Create session
curl --request POST \
--url https://api.example.com/v1/sessionsimport requests
url = "https://api.example.com/v1/sessions"
response = requests.post(url)
print(response.text)const options = {method: 'POST'};
fetch('https://api.example.com/v1/sessions', 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.example.com/v1/sessions",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/v1/sessions"
req, _ := http.NewRequest("POST", url, nil)
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.example.com/v1/sessions")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/v1/sessions")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
response = http.request(request)
puts response.read_bodyUser and Business Verifications
Create session
Start a verification session for one of your users.
POST
/
v1
/
sessions
Create session
curl --request POST \
--url https://api.example.com/v1/sessionsimport requests
url = "https://api.example.com/v1/sessions"
response = requests.post(url)
print(response.text)const options = {method: 'POST'};
fetch('https://api.example.com/v1/sessions', 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.example.com/v1/sessions",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/v1/sessions"
req, _ := http.NewRequest("POST", url, nil)
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.example.com/v1/sessions")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/v1/sessions")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
response = http.request(request)
puts response.read_bodyRequest
curl -X POST https://identity.contra.id/v1/sessions \
-H "x-api-key: $CONTRA_KEY" -H "Content-Type: application/json" \
-d '{
"workflow_id": "enhanced_kyc",
"vendor_data": "user-abc-123",
"callback": "https://yourapp.com/contra/webhook",
"expected_details": { "first_name": "Mikayla" }
}'
Parameters
| Field | Type | Required | Description |
|---|---|---|---|
workflow_id | string | yes | Which workflow to run. |
vendor_data | string | yes | Your own user id. Idempotency key with workflow_id. |
callback | url | no | Per-session webhook URL. |
metadata | object | no | Opaque JSON echoed back on the decision. |
contact_details | object | no | { email?, phone? } — pre-fill OTP steps. |
expected_details | object | no | Expected name / DOB / country — triggers mismatch warnings. |
Response · 201
{
"session_id": "sess_b3f1c2a4",
"url": "https://verify.contra.id/sess_b3f1c2a4",
"status": "pending",
"workflow_id": "enhanced_kyc",
"vendor_data": "user-abc-123",
"created_at": 1716900000,
"expires_at": 1716986400,
"idempotent_reuse": false
}
url. Poll GET /v1/sessions/:id or wait for the webhook.
Idempotency
Posting twice with the same(workflow_id, vendor_data) while a session is pending/in_progress/in_review returns the existing session with idempotent_reuse: true.⌘I