Upsert users bulk
curl --request PUT \
--url https://api.qobra.co/v1/users/bulk \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
{
"data": [
{
"email": "user-test-1@company.com",
"name": "User 1",
"role": "Sales Rep",
"currency": "EUR",
"calculation_currency": "USD",
"country": "France",
"code": "AO32ND56",
"arrival_date": "2023-12-01",
"junior": true
},
{
"email": "user-test-2@company.com",
"name": "User 2",
"role": "Manager",
"currency": "USD",
"calculation_currency": "USD",
"country": "Germany",
"code": "AO32ND57",
"arrival_date": "2024-01-01",
"junior": false
},
"..."
]
}
'import requests
url = "https://api.qobra.co/v1/users/bulk"
payload = { "data": [
{
"email": "user-test-1@company.com",
"name": "User 1",
"role": "Sales Rep",
"currency": "EUR",
"calculation_currency": "USD",
"country": "France",
"code": "AO32ND56",
"arrival_date": "2023-12-01",
"junior": True
},
{
"email": "user-test-2@company.com",
"name": "User 2",
"role": "Manager",
"currency": "USD",
"calculation_currency": "USD",
"country": "Germany",
"code": "AO32ND57",
"arrival_date": "2024-01-01",
"junior": False
},
"..."
] }
headers = {
"X-API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {'X-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
data: [
{
email: 'user-test-1@company.com',
name: 'User 1',
role: 'Sales Rep',
currency: 'EUR',
calculation_currency: 'USD',
country: 'France',
code: 'AO32ND56',
arrival_date: '2023-12-01',
junior: true
},
{
email: 'user-test-2@company.com',
name: 'User 2',
role: 'Manager',
currency: 'USD',
calculation_currency: 'USD',
country: 'Germany',
code: 'AO32ND57',
arrival_date: '2024-01-01',
junior: false
},
'...'
]
})
};
fetch('https://api.qobra.co/v1/users/bulk', 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.qobra.co/v1/users/bulk",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'data' => [
[
'email' => 'user-test-1@company.com',
'name' => 'User 1',
'role' => 'Sales Rep',
'currency' => 'EUR',
'calculation_currency' => 'USD',
'country' => 'France',
'code' => 'AO32ND56',
'arrival_date' => '2023-12-01',
'junior' => true
],
[
'email' => 'user-test-2@company.com',
'name' => 'User 2',
'role' => 'Manager',
'currency' => 'USD',
'calculation_currency' => 'USD',
'country' => 'Germany',
'code' => 'AO32ND57',
'arrival_date' => '2024-01-01',
'junior' => false
],
'...'
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-Key: <api-key>"
],
]);
$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.qobra.co/v1/users/bulk"
payload := strings.NewReader("{\n \"data\": [\n {\n \"email\": \"user-test-1@company.com\",\n \"name\": \"User 1\",\n \"role\": \"Sales Rep\",\n \"currency\": \"EUR\",\n \"calculation_currency\": \"USD\",\n \"country\": \"France\",\n \"code\": \"AO32ND56\",\n \"arrival_date\": \"2023-12-01\",\n \"junior\": true\n },\n {\n \"email\": \"user-test-2@company.com\",\n \"name\": \"User 2\",\n \"role\": \"Manager\",\n \"currency\": \"USD\",\n \"calculation_currency\": \"USD\",\n \"country\": \"Germany\",\n \"code\": \"AO32ND57\",\n \"arrival_date\": \"2024-01-01\",\n \"junior\": false\n },\n \"...\"\n ]\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("X-API-Key", "<api-key>")
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.put("https://api.qobra.co/v1/users/bulk")
.header("X-API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"data\": [\n {\n \"email\": \"user-test-1@company.com\",\n \"name\": \"User 1\",\n \"role\": \"Sales Rep\",\n \"currency\": \"EUR\",\n \"calculation_currency\": \"USD\",\n \"country\": \"France\",\n \"code\": \"AO32ND56\",\n \"arrival_date\": \"2023-12-01\",\n \"junior\": true\n },\n {\n \"email\": \"user-test-2@company.com\",\n \"name\": \"User 2\",\n \"role\": \"Manager\",\n \"currency\": \"USD\",\n \"calculation_currency\": \"USD\",\n \"country\": \"Germany\",\n \"code\": \"AO32ND57\",\n \"arrival_date\": \"2024-01-01\",\n \"junior\": false\n },\n \"...\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.qobra.co/v1/users/bulk")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["X-API-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"data\": [\n {\n \"email\": \"user-test-1@company.com\",\n \"name\": \"User 1\",\n \"role\": \"Sales Rep\",\n \"currency\": \"EUR\",\n \"calculation_currency\": \"USD\",\n \"country\": \"France\",\n \"code\": \"AO32ND56\",\n \"arrival_date\": \"2023-12-01\",\n \"junior\": true\n },\n {\n \"email\": \"user-test-2@company.com\",\n \"name\": \"User 2\",\n \"role\": \"Manager\",\n \"currency\": \"USD\",\n \"calculation_currency\": \"USD\",\n \"country\": \"Germany\",\n \"code\": \"AO32ND57\",\n \"arrival_date\": \"2024-01-01\",\n \"junior\": false\n },\n \"...\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"count": "<Upserted user count>",
"data": [
{
"id": "5537a5b05d6e4824940e9e1bb9a5ebb8",
"email": "user-test-1@company.com",
"name": "User 1",
"role": "Sales Rep",
"currency": "EUR",
"calculation_currency": "USD",
"country": "France",
"code": "AO32ND56",
"arrival_date": "2023-12-30",
"junior": true
},
{
"id": "5537a5b05d6e4824940e9e1bb9a5ebb9",
"email": "user-test-2@company.com",
"name": "User 2",
"role": "Manager",
"currency": "USD",
"calculation_currency": "USD",
"country": "Germany",
"code": "AO32ND57",
"arrival_date": "2024-01-01",
"junior": false
},
"..."
]
}{
"count": "<Errors count>",
"errors": [
{
"error": "ConflictError",
"resource": "<user-attribute-value-3>",
"user": "user-test-3@company.com",
"description": "This unique user attribute is used for another user"
},
{
"error": "NotFoundError",
"user": "user-test-3@company.com",
"resource": "user_attribute",
"description": "User attribute <user_attribute_name> not found"
},
{
"error": "ParsingError",
"user": "user-test-4@company.com",
"resource": "<field_name>",
"description": "We had issues parsing the <field_name> provided : value <value_received>"
},
"..."
]
}User management
Upsert users bulk
Upsert users in bulk.
PUT
/
v1
/
users
/
bulk
Upsert users bulk
curl --request PUT \
--url https://api.qobra.co/v1/users/bulk \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
{
"data": [
{
"email": "user-test-1@company.com",
"name": "User 1",
"role": "Sales Rep",
"currency": "EUR",
"calculation_currency": "USD",
"country": "France",
"code": "AO32ND56",
"arrival_date": "2023-12-01",
"junior": true
},
{
"email": "user-test-2@company.com",
"name": "User 2",
"role": "Manager",
"currency": "USD",
"calculation_currency": "USD",
"country": "Germany",
"code": "AO32ND57",
"arrival_date": "2024-01-01",
"junior": false
},
"..."
]
}
'import requests
url = "https://api.qobra.co/v1/users/bulk"
payload = { "data": [
{
"email": "user-test-1@company.com",
"name": "User 1",
"role": "Sales Rep",
"currency": "EUR",
"calculation_currency": "USD",
"country": "France",
"code": "AO32ND56",
"arrival_date": "2023-12-01",
"junior": True
},
{
"email": "user-test-2@company.com",
"name": "User 2",
"role": "Manager",
"currency": "USD",
"calculation_currency": "USD",
"country": "Germany",
"code": "AO32ND57",
"arrival_date": "2024-01-01",
"junior": False
},
"..."
] }
headers = {
"X-API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {'X-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
data: [
{
email: 'user-test-1@company.com',
name: 'User 1',
role: 'Sales Rep',
currency: 'EUR',
calculation_currency: 'USD',
country: 'France',
code: 'AO32ND56',
arrival_date: '2023-12-01',
junior: true
},
{
email: 'user-test-2@company.com',
name: 'User 2',
role: 'Manager',
currency: 'USD',
calculation_currency: 'USD',
country: 'Germany',
code: 'AO32ND57',
arrival_date: '2024-01-01',
junior: false
},
'...'
]
})
};
fetch('https://api.qobra.co/v1/users/bulk', 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.qobra.co/v1/users/bulk",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'data' => [
[
'email' => 'user-test-1@company.com',
'name' => 'User 1',
'role' => 'Sales Rep',
'currency' => 'EUR',
'calculation_currency' => 'USD',
'country' => 'France',
'code' => 'AO32ND56',
'arrival_date' => '2023-12-01',
'junior' => true
],
[
'email' => 'user-test-2@company.com',
'name' => 'User 2',
'role' => 'Manager',
'currency' => 'USD',
'calculation_currency' => 'USD',
'country' => 'Germany',
'code' => 'AO32ND57',
'arrival_date' => '2024-01-01',
'junior' => false
],
'...'
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-Key: <api-key>"
],
]);
$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.qobra.co/v1/users/bulk"
payload := strings.NewReader("{\n \"data\": [\n {\n \"email\": \"user-test-1@company.com\",\n \"name\": \"User 1\",\n \"role\": \"Sales Rep\",\n \"currency\": \"EUR\",\n \"calculation_currency\": \"USD\",\n \"country\": \"France\",\n \"code\": \"AO32ND56\",\n \"arrival_date\": \"2023-12-01\",\n \"junior\": true\n },\n {\n \"email\": \"user-test-2@company.com\",\n \"name\": \"User 2\",\n \"role\": \"Manager\",\n \"currency\": \"USD\",\n \"calculation_currency\": \"USD\",\n \"country\": \"Germany\",\n \"code\": \"AO32ND57\",\n \"arrival_date\": \"2024-01-01\",\n \"junior\": false\n },\n \"...\"\n ]\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("X-API-Key", "<api-key>")
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.put("https://api.qobra.co/v1/users/bulk")
.header("X-API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"data\": [\n {\n \"email\": \"user-test-1@company.com\",\n \"name\": \"User 1\",\n \"role\": \"Sales Rep\",\n \"currency\": \"EUR\",\n \"calculation_currency\": \"USD\",\n \"country\": \"France\",\n \"code\": \"AO32ND56\",\n \"arrival_date\": \"2023-12-01\",\n \"junior\": true\n },\n {\n \"email\": \"user-test-2@company.com\",\n \"name\": \"User 2\",\n \"role\": \"Manager\",\n \"currency\": \"USD\",\n \"calculation_currency\": \"USD\",\n \"country\": \"Germany\",\n \"code\": \"AO32ND57\",\n \"arrival_date\": \"2024-01-01\",\n \"junior\": false\n },\n \"...\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.qobra.co/v1/users/bulk")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["X-API-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"data\": [\n {\n \"email\": \"user-test-1@company.com\",\n \"name\": \"User 1\",\n \"role\": \"Sales Rep\",\n \"currency\": \"EUR\",\n \"calculation_currency\": \"USD\",\n \"country\": \"France\",\n \"code\": \"AO32ND56\",\n \"arrival_date\": \"2023-12-01\",\n \"junior\": true\n },\n {\n \"email\": \"user-test-2@company.com\",\n \"name\": \"User 2\",\n \"role\": \"Manager\",\n \"currency\": \"USD\",\n \"calculation_currency\": \"USD\",\n \"country\": \"Germany\",\n \"code\": \"AO32ND57\",\n \"arrival_date\": \"2024-01-01\",\n \"junior\": false\n },\n \"...\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"count": "<Upserted user count>",
"data": [
{
"id": "5537a5b05d6e4824940e9e1bb9a5ebb8",
"email": "user-test-1@company.com",
"name": "User 1",
"role": "Sales Rep",
"currency": "EUR",
"calculation_currency": "USD",
"country": "France",
"code": "AO32ND56",
"arrival_date": "2023-12-30",
"junior": true
},
{
"id": "5537a5b05d6e4824940e9e1bb9a5ebb9",
"email": "user-test-2@company.com",
"name": "User 2",
"role": "Manager",
"currency": "USD",
"calculation_currency": "USD",
"country": "Germany",
"code": "AO32ND57",
"arrival_date": "2024-01-01",
"junior": false
},
"..."
]
}{
"count": "<Errors count>",
"errors": [
{
"error": "ConflictError",
"resource": "<user-attribute-value-3>",
"user": "user-test-3@company.com",
"description": "This unique user attribute is used for another user"
},
{
"error": "NotFoundError",
"user": "user-test-3@company.com",
"resource": "user_attribute",
"description": "User attribute <user_attribute_name> not found"
},
{
"error": "ParsingError",
"user": "user-test-4@company.com",
"resource": "<field_name>",
"description": "We had issues parsing the <field_name> provided : value <value_received>"
},
"..."
]
}Create new users or update existing ones.

Those attributes will have an auto-generated API key that you can overwrite. This key will allow you to provide value for those attribute at user creation through API.
How to use user attributes
If you want to add custom columns to your user table, create them inQobra settings > User attributes first.

Variable api keys
This endpoint is based on dynamic fields. This mean that all annotations that look like<variable-key>, will have to or will be replaced by their
actual API keys.
Behavior
- Conflict Rule and upsert: Be careful, email field on user is unique. For each user, if it already exist (according to email), we will update the existing one and if it does not exist yet, we will create it.
- Transaction: If there is at least one user that triggers an error at import, we return you an error and import nothing. You have to fix your payload and send it to us again. And if the answer is a success, it means that every users you sent us have been upserted
- Empty Field Rule: If you don’t specify a field in upsert, this field won’t be modified. If you want to empty a field, you have to send us a value null associated to the given field api key
- Limit: you can’t upsert more than 200 users at a time.
- Error behavior: In case of any error, your users wont be upserted
Authorizations
Body
application/json
The body contains the list of user data necessary to create a new user in Qobra
Show child attributes
Show child attributes
Was this page helpful?
⌘I