Grant an entitlement
curl --request POST \
--url https://api.qonversion.io/v3/users/{user_id}/entitlements \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"id": "plus",
"expires": 1704067200
}
'import requests
url = "https://api.qonversion.io/v3/users/{user_id}/entitlements"
payload = {
"id": "plus",
"expires": 1704067200
}
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({id: 'plus', expires: 1704067200})
};
fetch('https://api.qonversion.io/v3/users/{user_id}/entitlements', 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/users/{user_id}/entitlements",
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([
'id' => 'plus',
'expires' => 1704067200
]),
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/users/{user_id}/entitlements")
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 \"id\": \"plus\",\n \"expires\": 1704067200\n}"
response = http.request(request)
puts response.read_bodypackage main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.qonversion.io/v3/users/{user_id}/entitlements"
payload := strings.NewReader("{\n \"id\": \"plus\",\n \"expires\": 1704067200\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/users/{user_id}/entitlements")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"id\": \"plus\",\n \"expires\": 1704067200\n}")
.asString();{
"id": "plus",
"active": true,
"started": 1678894940,
"expires": 1704067200,
"source": "manual"
}{
"error": {
"code": "invalid_entitlement_data",
"message": "Invalid expires at value has been provided, should be in unix timestamp format in seconds in future",
"type": "request"
}
}Entitlements
Grant an entitlement
Manually grants an entitlement to a user. Requires Secret Key authentication.
POST
/
users
/
{user_id}
/
entitlements
Grant an entitlement
curl --request POST \
--url https://api.qonversion.io/v3/users/{user_id}/entitlements \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"id": "plus",
"expires": 1704067200
}
'import requests
url = "https://api.qonversion.io/v3/users/{user_id}/entitlements"
payload = {
"id": "plus",
"expires": 1704067200
}
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({id: 'plus', expires: 1704067200})
};
fetch('https://api.qonversion.io/v3/users/{user_id}/entitlements', 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/users/{user_id}/entitlements",
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([
'id' => 'plus',
'expires' => 1704067200
]),
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/users/{user_id}/entitlements")
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 \"id\": \"plus\",\n \"expires\": 1704067200\n}"
response = http.request(request)
puts response.read_bodypackage main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.qonversion.io/v3/users/{user_id}/entitlements"
payload := strings.NewReader("{\n \"id\": \"plus\",\n \"expires\": 1704067200\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/users/{user_id}/entitlements")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"id\": \"plus\",\n \"expires\": 1704067200\n}")
.asString();{
"id": "plus",
"active": true,
"started": 1678894940,
"expires": 1704067200,
"source": "manual"
}{
"error": {
"code": "invalid_entitlement_data",
"message": "Invalid expires at value has been provided, should be in unix timestamp format in seconds in future",
"type": "request"
}
}This endpoint requires a Secret Key (
sk_ prefix). Never expose it in client-side code.Authorizations
Use your Secret Key (prefixed with sk_) from the Qonversion dashboard
(Project Settings -> Project Keys -> Secret Key). Sandbox secret keys are prefixed
with test_sk_.
Never expose the secret key in client-side code.
Path Parameters
Qonversion User ID
Body
application/json
Response
Entitlement granted
Entitlement identifier
Example:
"plus"
Whether the user currently has the entitlement
Example:
true
Unix epoch seconds when entitlement was activated
Example:
1652438020
Unix epoch seconds when entitlement expires
Example:
1654215637
Purchase origin
Available options:
appstore, playstore, stripe, paddle, manual, unknown Example:
"appstore"
Show child attributes
Show child attributes