Create or Update a User
curl --request POST \
--url https://api.captaindata.co/v3/users \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--header 'x-project-id: <api-key>' \
--data '
{
"email": "<string>",
"full_name": "<string>",
"country": "<string>",
"timezone": "<string>",
"uid": "<string>"
}
'import requests
url = "https://api.captaindata.co/v3/users"
payload = {
"email": "<string>",
"full_name": "<string>",
"country": "<string>",
"timezone": "<string>",
"uid": "<string>"
}
headers = {
"Authorization": "<api-key>",
"x-project-id": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
Authorization: '<api-key>',
'x-project-id': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
email: '<string>',
full_name: '<string>',
country: '<string>',
timezone: '<string>',
uid: '<string>'
})
};
fetch('https://api.captaindata.co/v3/users', 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.captaindata.co/v3/users",
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' => '<string>',
'full_name' => '<string>',
'country' => '<string>',
'timezone' => '<string>',
'uid' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"Content-Type: application/json",
"x-project-id: <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.captaindata.co/v3/users"
payload := strings.NewReader("{\n \"email\": \"<string>\",\n \"full_name\": \"<string>\",\n \"country\": \"<string>\",\n \"timezone\": \"<string>\",\n \"uid\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<api-key>")
req.Header.Add("x-project-id", "<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.post("https://api.captaindata.co/v3/users")
.header("Authorization", "<api-key>")
.header("x-project-id", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"email\": \"<string>\",\n \"full_name\": \"<string>\",\n \"country\": \"<string>\",\n \"timezone\": \"<string>\",\n \"uid\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.captaindata.co/v3/users")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["x-project-id"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"email\": \"<string>\",\n \"full_name\": \"<string>\",\n \"country\": \"<string>\",\n \"timezone\": \"<string>\",\n \"uid\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"user": {
"uid": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"email": "example@example.com",
"first_name": "John",
"last_name": "Doe",
"full_name": "John Doe",
"country": "US",
"project_uid": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"accounts": []
},
"message": "User created."
}{
"message": "Country code is not formatted correctly. Please use ISO 3166-1 alpha-2 codes (e.g., 'us' or 'US' for United States)"
}Users
Create or Update a User
POST
/
v3
/
users
Create or Update a User
curl --request POST \
--url https://api.captaindata.co/v3/users \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--header 'x-project-id: <api-key>' \
--data '
{
"email": "<string>",
"full_name": "<string>",
"country": "<string>",
"timezone": "<string>",
"uid": "<string>"
}
'import requests
url = "https://api.captaindata.co/v3/users"
payload = {
"email": "<string>",
"full_name": "<string>",
"country": "<string>",
"timezone": "<string>",
"uid": "<string>"
}
headers = {
"Authorization": "<api-key>",
"x-project-id": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
Authorization: '<api-key>',
'x-project-id': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
email: '<string>',
full_name: '<string>',
country: '<string>',
timezone: '<string>',
uid: '<string>'
})
};
fetch('https://api.captaindata.co/v3/users', 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.captaindata.co/v3/users",
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' => '<string>',
'full_name' => '<string>',
'country' => '<string>',
'timezone' => '<string>',
'uid' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"Content-Type: application/json",
"x-project-id: <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.captaindata.co/v3/users"
payload := strings.NewReader("{\n \"email\": \"<string>\",\n \"full_name\": \"<string>\",\n \"country\": \"<string>\",\n \"timezone\": \"<string>\",\n \"uid\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<api-key>")
req.Header.Add("x-project-id", "<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.post("https://api.captaindata.co/v3/users")
.header("Authorization", "<api-key>")
.header("x-project-id", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"email\": \"<string>\",\n \"full_name\": \"<string>\",\n \"country\": \"<string>\",\n \"timezone\": \"<string>\",\n \"uid\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.captaindata.co/v3/users")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["x-project-id"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"email\": \"<string>\",\n \"full_name\": \"<string>\",\n \"country\": \"<string>\",\n \"timezone\": \"<string>\",\n \"uid\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"user": {
"uid": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"email": "example@example.com",
"first_name": "John",
"last_name": "Doe",
"full_name": "John Doe",
"country": "US",
"project_uid": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"accounts": []
},
"message": "User created."
}{
"message": "Country code is not formatted correctly. Please use ISO 3166-1 alpha-2 codes (e.g., 'us' or 'US' for United States)"
}Authorizations
The Authorization header must include 'x-api-key' followed by your API key (e.g., 'Authorization: x-api-key YOUR_API_KEY').
Workspace UID required to identify the workspace.
Body
application/json
Response
Successful Response
⌘I