Create an identity
curl --request POST \
--url https://api.qonversion.io/v3/identities/{identity_id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"user_id": "QON_8968d347c4a24168b4885ee087fbd635"
}
'import requests
url = "https://api.qonversion.io/v3/identities/{identity_id}"
payload = { "user_id": "QON_8968d347c4a24168b4885ee087fbd635" }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({user_id: 'QON_8968d347c4a24168b4885ee087fbd635'})
};
fetch('https://api.qonversion.io/v3/identities/{identity_id}', 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.qonversion.io/v3/identities/{identity_id}",
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([
'user_id' => 'QON_8968d347c4a24168b4885ee087fbd635'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}require 'uri'
require 'net/http'
url = URI("https://api.qonversion.io/v3/identities/{identity_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"user_id\": \"QON_8968d347c4a24168b4885ee087fbd635\"\n}"
response = http.request(request)
puts response.read_bodypackage main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.qonversion.io/v3/identities/{identity_id}"
payload := strings.NewReader("{\n \"user_id\": \"QON_8968d347c4a24168b4885ee087fbd635\"\n}")
req, _ := http.NewRequest("POST", url, payload)
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.qonversion.io/v3/identities/{identity_id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"user_id\": \"QON_8968d347c4a24168b4885ee087fbd635\"\n}")
.asString();{
"id": "new_identities_user",
"user_id": "QON_8968d347c4a24168b4885ee087fbd635"
}{
"error": {
"code": "<string>",
"message": "<string>"
},
"meta": {
"reference": "https://documentation.qonversion.io/reference/handling-api-errors"
}
}{
"error": {
"code": "<string>",
"message": "<string>"
},
"meta": {
"reference": "https://documentation.qonversion.io/reference/handling-api-errors"
}
}{
"error": {
"code": "invalid_request",
"message": "identity already exists: it's linked to another user",
"type": "request"
}
}Identity
Create an identity
Creates an identity. If user_id is not provided, a new Qonversion user is created automatically.
POST
/
identities
/
{identity_id}
Create an identity
curl --request POST \
--url https://api.qonversion.io/v3/identities/{identity_id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"user_id": "QON_8968d347c4a24168b4885ee087fbd635"
}
'import requests
url = "https://api.qonversion.io/v3/identities/{identity_id}"
payload = { "user_id": "QON_8968d347c4a24168b4885ee087fbd635" }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({user_id: 'QON_8968d347c4a24168b4885ee087fbd635'})
};
fetch('https://api.qonversion.io/v3/identities/{identity_id}', 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.qonversion.io/v3/identities/{identity_id}",
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([
'user_id' => 'QON_8968d347c4a24168b4885ee087fbd635'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}require 'uri'
require 'net/http'
url = URI("https://api.qonversion.io/v3/identities/{identity_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"user_id\": \"QON_8968d347c4a24168b4885ee087fbd635\"\n}"
response = http.request(request)
puts response.read_bodypackage main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.qonversion.io/v3/identities/{identity_id}"
payload := strings.NewReader("{\n \"user_id\": \"QON_8968d347c4a24168b4885ee087fbd635\"\n}")
req, _ := http.NewRequest("POST", url, payload)
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.qonversion.io/v3/identities/{identity_id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"user_id\": \"QON_8968d347c4a24168b4885ee087fbd635\"\n}")
.asString();{
"id": "new_identities_user",
"user_id": "QON_8968d347c4a24168b4885ee087fbd635"
}{
"error": {
"code": "<string>",
"message": "<string>"
},
"meta": {
"reference": "https://documentation.qonversion.io/reference/handling-api-errors"
}
}{
"error": {
"code": "<string>",
"message": "<string>"
},
"meta": {
"reference": "https://documentation.qonversion.io/reference/handling-api-errors"
}
}{
"error": {
"code": "invalid_request",
"message": "identity already exists: it's linked to another user",
"type": "request"
}
}Authorizations
Use your Project Key from the Qonversion dashboard (Project Settings -> Project Keys -> Project Key).
Production keys have no prefix; keys prefixed with test_ target the sandbox environment.
Example (sandbox): Bearer test_PV77YHL7qnGvsdmpTs7gimsxUvY-Znl2
Example (production): Bearer JFPATc4VaaWYsfurml3qZ4zsmNw0VfWH
Path Parameters
User Identity ID
Body
application/json
Qonversion User ID. If omitted, a new user is created.
⌘I