Register this device
PUT
/v1/devices
const url = 'https://api.pocketbell.dev/v1/devices';const options = { method: 'PUT', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"apns_token":"bab976c0e4f96f54421bd416d8bf7e2e77811aa40b40c81023d8ab1c9638afac","apns_environment":"sandbox","platform":"ios","name":"iPhone","install_id":"2489E9AD-2EE2-8E00-8EC9-32D5F69181C0","live_activity_start_token":"example"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request PUT \ --url https://api.pocketbell.dev/v1/devices \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "apns_token": "bab976c0e4f96f54421bd416d8bf7e2e77811aa40b40c81023d8ab1c9638afac", "apns_environment": "sandbox", "platform": "ios", "name": "iPhone", "install_id": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "live_activity_start_token": "example" }'Registers the device’s APNs token for the signed-in account, or updates it. The apps call this on every launch, since APNs can change a token.
Authorizations
Section titled “Authorizations”Request Bodyrequired
Section titled “Request Bodyrequired”Media typeapplication/json
object
apns_token
required
string
Example
bab976c0e4f96f54421bd416d8bf7e2e77811aa40b40c81023d8ab1c9638afacapns_environment
required
Sandbox for builds run from Xcode, production for TestFlight and the App Store.
string
platform
required
string
name
required
string
Example
iPhoneinstall_id
A random ID the app keeps on this device, the same across reinstalls, builds and sign-ins, so each device is listed once.
string format: uuid
live_activity_start_token
IPhone: ActivityKit’s push-to-start token, so a Live Activity can be started on this device.
string
Responses
Section titled “Responses”Registered.
Media typeapplication/json
object
id
required
string
name
required
string
platform
required
string
apns_environment
required
string
Example
{ "id": "dev_01jz9k6q8r3tfv0x2m4n5p7s8a", "platform": "ios", "apns_environment": "sandbox"}The request was invalid.
Media typeapplication/json
object
error
required
object
code
required
string
message
required
string
details
Which fields were wrong, for invalid_request.
Array<object>
object
field
required
string
message
required
string
Example
{ "error": { "code": "invalid_request" }}Missing or ended session.
Media typeapplication/json
object
error
required
object
code
required
string
message
required
string
details
Which fields were wrong, for invalid_request.
Array<object>
object
field
required
string
message
required
string
Example
{ "error": { "code": "invalid_request" }}