Register a device for push
curl --request POST \
--url https://api.hq.zone/v1/api/device-tokens \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"token": "<string>",
"bundle_id": "<string>",
"environment": "<string>",
"platform": "<string>"
}
'import requests
url = "https://api.hq.zone/v1/api/device-tokens"
payload = {
"token": "<string>",
"bundle_id": "<string>",
"environment": "<string>",
"platform": "<string>"
}
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({
token: '<string>',
bundle_id: '<string>',
environment: '<string>',
platform: '<string>'
})
};
fetch('https://api.hq.zone/v1/api/device-tokens', 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.hq.zone/v1/api/device-tokens",
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([
'token' => '<string>',
'bundle_id' => '<string>',
'environment' => '<string>',
'platform' => '<string>'
]),
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;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.hq.zone/v1/api/device-tokens"
payload := strings.NewReader("{\n \"token\": \"<string>\",\n \"bundle_id\": \"<string>\",\n \"environment\": \"<string>\",\n \"platform\": \"<string>\"\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.hq.zone/v1/api/device-tokens")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"token\": \"<string>\",\n \"bundle_id\": \"<string>\",\n \"environment\": \"<string>\",\n \"platform\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.hq.zone/v1/api/device-tokens")
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 \"token\": \"<string>\",\n \"bundle_id\": \"<string>\",\n \"environment\": \"<string>\",\n \"platform\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"ok": true
}Notifications
Register a device for push
Upserts the caller’s APNs device token for the current workspace. Idempotent
per (token, tenant): a re-register from the same device updates the owning
user, platform, bundle id, environment and refreshes last_seen_at.
POST
/
v1
/
api
/
device-tokens
Register a device for push
curl --request POST \
--url https://api.hq.zone/v1/api/device-tokens \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"token": "<string>",
"bundle_id": "<string>",
"environment": "<string>",
"platform": "<string>"
}
'import requests
url = "https://api.hq.zone/v1/api/device-tokens"
payload = {
"token": "<string>",
"bundle_id": "<string>",
"environment": "<string>",
"platform": "<string>"
}
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({
token: '<string>',
bundle_id: '<string>',
environment: '<string>',
platform: '<string>'
})
};
fetch('https://api.hq.zone/v1/api/device-tokens', 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.hq.zone/v1/api/device-tokens",
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([
'token' => '<string>',
'bundle_id' => '<string>',
'environment' => '<string>',
'platform' => '<string>'
]),
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;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.hq.zone/v1/api/device-tokens"
payload := strings.NewReader("{\n \"token\": \"<string>\",\n \"bundle_id\": \"<string>\",\n \"environment\": \"<string>\",\n \"platform\": \"<string>\"\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.hq.zone/v1/api/device-tokens")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"token\": \"<string>\",\n \"bundle_id\": \"<string>\",\n \"environment\": \"<string>\",\n \"platform\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.hq.zone/v1/api/device-tokens")
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 \"token\": \"<string>\",\n \"bundle_id\": \"<string>\",\n \"environment\": \"<string>\",\n \"platform\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"ok": true
}Authorizations
bearer_patoauth2
Personal Access Token. Send as Authorization: Bearer hq_pat_....
Body
application/json
APNs device token, lowercase hex (as handed to the app by the OS).
The app's bundle id == the APNs topic, e.g. "io.tic.HQ".
"production" (default) or "sandbox" (debug builds on the APNs sandbox).
"ios" today; reserved for "android" (FCM) later.
Response
200 - application/json
Registered
⌘I