Devices
Create or refresh a device
Registers the calling user’s device for push notifications in the current company. If the user already has this push_token for the company, the device is refreshed and 200 is returned; otherwise a new device is created and 201 is returned. Only push_token is required. Requires a user token; a user can only manage their own devices.
POST
/
api
/
devices
/
create_or_refresh
Create or refresh a device
curl --request POST \
--url https://api.fluid.app/api/devices/create_or_refresh \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"push_token": "ExponentPushToken[dM3kQz8vT1xLp4RwN7yBhC]",
"device_type": "ios",
"device_uid": "8C2F4A71-3D9E-4B56-A0E1-5F7C9D2B8E64",
"project_id": "b7e4c2a9-1f35-4d8b-9c60-2a8e5f1d7b43",
"bundle_id": "com.dundermifflin.app"
}
'import requests
url = "https://api.fluid.app/api/devices/create_or_refresh"
payload = {
"push_token": "ExponentPushToken[dM3kQz8vT1xLp4RwN7yBhC]",
"device_type": "ios",
"device_uid": "8C2F4A71-3D9E-4B56-A0E1-5F7C9D2B8E64",
"project_id": "b7e4c2a9-1f35-4d8b-9c60-2a8e5f1d7b43",
"bundle_id": "com.dundermifflin.app"
}
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({
push_token: 'ExponentPushToken[dM3kQz8vT1xLp4RwN7yBhC]',
device_type: 'ios',
device_uid: '8C2F4A71-3D9E-4B56-A0E1-5F7C9D2B8E64',
project_id: 'b7e4c2a9-1f35-4d8b-9c60-2a8e5f1d7b43',
bundle_id: 'com.dundermifflin.app'
})
};
fetch('https://api.fluid.app/api/devices/create_or_refresh', 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.fluid.app/api/devices/create_or_refresh",
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([
'push_token' => 'ExponentPushToken[dM3kQz8vT1xLp4RwN7yBhC]',
'device_type' => 'ios',
'device_uid' => '8C2F4A71-3D9E-4B56-A0E1-5F7C9D2B8E64',
'project_id' => 'b7e4c2a9-1f35-4d8b-9c60-2a8e5f1d7b43',
'bundle_id' => 'com.dundermifflin.app'
]),
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.fluid.app/api/devices/create_or_refresh"
payload := strings.NewReader("{\n \"push_token\": \"ExponentPushToken[dM3kQz8vT1xLp4RwN7yBhC]\",\n \"device_type\": \"ios\",\n \"device_uid\": \"8C2F4A71-3D9E-4B56-A0E1-5F7C9D2B8E64\",\n \"project_id\": \"b7e4c2a9-1f35-4d8b-9c60-2a8e5f1d7b43\",\n \"bundle_id\": \"com.dundermifflin.app\"\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.fluid.app/api/devices/create_or_refresh")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"push_token\": \"ExponentPushToken[dM3kQz8vT1xLp4RwN7yBhC]\",\n \"device_type\": \"ios\",\n \"device_uid\": \"8C2F4A71-3D9E-4B56-A0E1-5F7C9D2B8E64\",\n \"project_id\": \"b7e4c2a9-1f35-4d8b-9c60-2a8e5f1d7b43\",\n \"bundle_id\": \"com.dundermifflin.app\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.fluid.app/api/devices/create_or_refresh")
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 \"push_token\": \"ExponentPushToken[dM3kQz8vT1xLp4RwN7yBhC]\",\n \"device_type\": \"ios\",\n \"device_uid\": \"8C2F4A71-3D9E-4B56-A0E1-5F7C9D2B8E64\",\n \"project_id\": \"b7e4c2a9-1f35-4d8b-9c60-2a8e5f1d7b43\",\n \"bundle_id\": \"com.dundermifflin.app\"\n}"
response = http.request(request)
puts response.read_body{
"device": {
"id": 90417,
"user_id": 52814,
"company_id": 1405,
"device_type": "ios",
"token": "ExponentPushToken[dM3kQz8vT1xLp4RwN7yBhC]",
"device_uid": "8C2F4A71-3D9E-4B56-A0E1-5F7C9D2B8E64",
"project_id": "b7e4c2a9-1f35-4d8b-9c60-2a8e5f1d7b43",
"bundle_id": "com.dundermifflin.app",
"refreshed_at": "2026-09-21T09:12:44Z",
"created_at": "2026-09-14T15:32:08Z",
"updated_at": "2026-09-21T09:12:44Z",
"user": {
"id": 52814,
"first_name": "Dwight",
"last_name": "Schrute",
"email": "dwight.schrute@dundermifflin.com",
"phone": "+15705550142",
"image_url": null
}
},
"meta": {
"request_id": "3f9c1a7e-5b2d-4c8e-9a61-2d7f0b4e8c13",
"timestamp": "2026-09-21T09:12:45Z"
}
}{
"device": {
"id": 90417,
"user_id": 52814,
"company_id": 1405,
"device_type": "ios",
"token": "ExponentPushToken[dM3kQz8vT1xLp4RwN7yBhC]",
"device_uid": "8C2F4A71-3D9E-4B56-A0E1-5F7C9D2B8E64",
"project_id": "b7e4c2a9-1f35-4d8b-9c60-2a8e5f1d7b43",
"bundle_id": "com.dundermifflin.app",
"refreshed_at": "2026-09-14T15:32:08Z",
"created_at": "2026-09-14T15:32:08Z",
"updated_at": "2026-09-14T15:32:08Z",
"user": {
"id": 52814,
"first_name": "Dwight",
"last_name": "Schrute",
"email": "dwight.schrute@dundermifflin.com",
"phone": "+15705550142",
"image_url": null
}
},
"meta": {
"request_id": "3f9c1a7e-5b2d-4c8e-9a61-2d7f0b4e8c13",
"timestamp": "2026-09-21T09:12:45Z"
}
}{
"message": "<string>"
}Body
application/json
⌘I
Create or refresh a device
curl --request POST \
--url https://api.fluid.app/api/devices/create_or_refresh \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"push_token": "ExponentPushToken[dM3kQz8vT1xLp4RwN7yBhC]",
"device_type": "ios",
"device_uid": "8C2F4A71-3D9E-4B56-A0E1-5F7C9D2B8E64",
"project_id": "b7e4c2a9-1f35-4d8b-9c60-2a8e5f1d7b43",
"bundle_id": "com.dundermifflin.app"
}
'import requests
url = "https://api.fluid.app/api/devices/create_or_refresh"
payload = {
"push_token": "ExponentPushToken[dM3kQz8vT1xLp4RwN7yBhC]",
"device_type": "ios",
"device_uid": "8C2F4A71-3D9E-4B56-A0E1-5F7C9D2B8E64",
"project_id": "b7e4c2a9-1f35-4d8b-9c60-2a8e5f1d7b43",
"bundle_id": "com.dundermifflin.app"
}
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({
push_token: 'ExponentPushToken[dM3kQz8vT1xLp4RwN7yBhC]',
device_type: 'ios',
device_uid: '8C2F4A71-3D9E-4B56-A0E1-5F7C9D2B8E64',
project_id: 'b7e4c2a9-1f35-4d8b-9c60-2a8e5f1d7b43',
bundle_id: 'com.dundermifflin.app'
})
};
fetch('https://api.fluid.app/api/devices/create_or_refresh', 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.fluid.app/api/devices/create_or_refresh",
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([
'push_token' => 'ExponentPushToken[dM3kQz8vT1xLp4RwN7yBhC]',
'device_type' => 'ios',
'device_uid' => '8C2F4A71-3D9E-4B56-A0E1-5F7C9D2B8E64',
'project_id' => 'b7e4c2a9-1f35-4d8b-9c60-2a8e5f1d7b43',
'bundle_id' => 'com.dundermifflin.app'
]),
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.fluid.app/api/devices/create_or_refresh"
payload := strings.NewReader("{\n \"push_token\": \"ExponentPushToken[dM3kQz8vT1xLp4RwN7yBhC]\",\n \"device_type\": \"ios\",\n \"device_uid\": \"8C2F4A71-3D9E-4B56-A0E1-5F7C9D2B8E64\",\n \"project_id\": \"b7e4c2a9-1f35-4d8b-9c60-2a8e5f1d7b43\",\n \"bundle_id\": \"com.dundermifflin.app\"\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.fluid.app/api/devices/create_or_refresh")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"push_token\": \"ExponentPushToken[dM3kQz8vT1xLp4RwN7yBhC]\",\n \"device_type\": \"ios\",\n \"device_uid\": \"8C2F4A71-3D9E-4B56-A0E1-5F7C9D2B8E64\",\n \"project_id\": \"b7e4c2a9-1f35-4d8b-9c60-2a8e5f1d7b43\",\n \"bundle_id\": \"com.dundermifflin.app\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.fluid.app/api/devices/create_or_refresh")
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 \"push_token\": \"ExponentPushToken[dM3kQz8vT1xLp4RwN7yBhC]\",\n \"device_type\": \"ios\",\n \"device_uid\": \"8C2F4A71-3D9E-4B56-A0E1-5F7C9D2B8E64\",\n \"project_id\": \"b7e4c2a9-1f35-4d8b-9c60-2a8e5f1d7b43\",\n \"bundle_id\": \"com.dundermifflin.app\"\n}"
response = http.request(request)
puts response.read_body{
"device": {
"id": 90417,
"user_id": 52814,
"company_id": 1405,
"device_type": "ios",
"token": "ExponentPushToken[dM3kQz8vT1xLp4RwN7yBhC]",
"device_uid": "8C2F4A71-3D9E-4B56-A0E1-5F7C9D2B8E64",
"project_id": "b7e4c2a9-1f35-4d8b-9c60-2a8e5f1d7b43",
"bundle_id": "com.dundermifflin.app",
"refreshed_at": "2026-09-21T09:12:44Z",
"created_at": "2026-09-14T15:32:08Z",
"updated_at": "2026-09-21T09:12:44Z",
"user": {
"id": 52814,
"first_name": "Dwight",
"last_name": "Schrute",
"email": "dwight.schrute@dundermifflin.com",
"phone": "+15705550142",
"image_url": null
}
},
"meta": {
"request_id": "3f9c1a7e-5b2d-4c8e-9a61-2d7f0b4e8c13",
"timestamp": "2026-09-21T09:12:45Z"
}
}{
"device": {
"id": 90417,
"user_id": 52814,
"company_id": 1405,
"device_type": "ios",
"token": "ExponentPushToken[dM3kQz8vT1xLp4RwN7yBhC]",
"device_uid": "8C2F4A71-3D9E-4B56-A0E1-5F7C9D2B8E64",
"project_id": "b7e4c2a9-1f35-4d8b-9c60-2a8e5f1d7b43",
"bundle_id": "com.dundermifflin.app",
"refreshed_at": "2026-09-14T15:32:08Z",
"created_at": "2026-09-14T15:32:08Z",
"updated_at": "2026-09-14T15:32:08Z",
"user": {
"id": 52814,
"first_name": "Dwight",
"last_name": "Schrute",
"email": "dwight.schrute@dundermifflin.com",
"phone": "+15705550142",
"image_url": null
}
},
"meta": {
"request_id": "3f9c1a7e-5b2d-4c8e-9a61-2d7f0b4e8c13",
"timestamp": "2026-09-21T09:12:45Z"
}
}{
"message": "<string>"
}