JavaScript
import Courier from '@trycourier/courier';
const client = new Courier({
apiKey: process.env['COURIER_API_KEY'], // This is the default and can be omitted
});
const tokens = await client.users.tokens.list('user_id');
console.log(tokens.tokens);import os
from courier import Courier
client = Courier(
api_key=os.environ.get("COURIER_API_KEY"), # This is the default and can be omitted
)
tokens = client.users.tokens.list(
"user_id",
)
print(tokens.tokens)package main
import (
"context"
"fmt"
"github.com/trycourier/courier-go"
"github.com/trycourier/courier-go/option"
)
func main() {
client := courier.NewClient(
option.WithAPIKey("My API Key"),
)
tokens, err := client.Users.Tokens.List(context.TODO(), "user_id")
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", tokens.Tokens)
}package com.courier.example;
import com.courier.client.CourierClient;
import com.courier.client.okhttp.CourierOkHttpClient;
import com.courier.models.users.tokens.TokenListParams;
import com.courier.models.users.tokens.TokenListResponse;
public final class Main {
private Main() {}
public static void main(String[] args) {
CourierClient client = CourierOkHttpClient.fromEnv();
TokenListResponse tokens = client.users().tokens().list("user_id");
}
}require "courier"
courier = Courier::Client.new(api_key: "My API Key")
tokens = courier.users.tokens.list("user_id")
puts(tokens)<?php
require_once dirname(__DIR__) . '/vendor/autoload.php';
use Courier\Client;
use Courier\Core\Exceptions\APIException;
$client = new Client(apiKey: getenv('COURIER_API_KEY') ?: 'My API Key');
try {
$tokens = $client->users->tokens->list('user_id');
var_dump($tokens);
} catch (APIException $e) {
echo $e->getMessage();
}using System;
using TryCourier;
using TryCourier.Models.Users.Tokens;
CourierClient client = new();
TokenListParams parameters = new() { UserID = "user_id" };
var tokens = await client.Users.Tokens.List(parameters);
Console.WriteLine(tokens);courier users:tokens list \
--api-key 'My API Key' \
--user-id user_idcurl --request GET \
--url https://api.courier.com/users/{user_id}/tokens \
--header 'Authorization: Bearer <token>'{
"tokens": [
{
"token": "string",
"provider_key": "firebase-fcm",
"expiry_date": "string",
"properties": {},
"device": {
"app_id": "abc-123",
"ad_id": "abc-123",
"device_id": "abc-123",
"platform": "string",
"manufacturer": "string",
"model": "string"
},
"tracking": {
"os_version": "string",
"ip": "string",
"lat": "string",
"long": "string"
}
}
]
}{
"message": "Example message text",
"type": "invalid_request_error"
}Device Tokens
Get all tokens
Gets all tokens available for a :user_id
GET
/
users
/
{user_id}
/
tokens
JavaScript
import Courier from '@trycourier/courier';
const client = new Courier({
apiKey: process.env['COURIER_API_KEY'], // This is the default and can be omitted
});
const tokens = await client.users.tokens.list('user_id');
console.log(tokens.tokens);import os
from courier import Courier
client = Courier(
api_key=os.environ.get("COURIER_API_KEY"), # This is the default and can be omitted
)
tokens = client.users.tokens.list(
"user_id",
)
print(tokens.tokens)package main
import (
"context"
"fmt"
"github.com/trycourier/courier-go"
"github.com/trycourier/courier-go/option"
)
func main() {
client := courier.NewClient(
option.WithAPIKey("My API Key"),
)
tokens, err := client.Users.Tokens.List(context.TODO(), "user_id")
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", tokens.Tokens)
}package com.courier.example;
import com.courier.client.CourierClient;
import com.courier.client.okhttp.CourierOkHttpClient;
import com.courier.models.users.tokens.TokenListParams;
import com.courier.models.users.tokens.TokenListResponse;
public final class Main {
private Main() {}
public static void main(String[] args) {
CourierClient client = CourierOkHttpClient.fromEnv();
TokenListResponse tokens = client.users().tokens().list("user_id");
}
}require "courier"
courier = Courier::Client.new(api_key: "My API Key")
tokens = courier.users.tokens.list("user_id")
puts(tokens)<?php
require_once dirname(__DIR__) . '/vendor/autoload.php';
use Courier\Client;
use Courier\Core\Exceptions\APIException;
$client = new Client(apiKey: getenv('COURIER_API_KEY') ?: 'My API Key');
try {
$tokens = $client->users->tokens->list('user_id');
var_dump($tokens);
} catch (APIException $e) {
echo $e->getMessage();
}using System;
using TryCourier;
using TryCourier.Models.Users.Tokens;
CourierClient client = new();
TokenListParams parameters = new() { UserID = "user_id" };
var tokens = await client.Users.Tokens.List(parameters);
Console.WriteLine(tokens);courier users:tokens list \
--api-key 'My API Key' \
--user-id user_idcurl --request GET \
--url https://api.courier.com/users/{user_id}/tokens \
--header 'Authorization: Bearer <token>'{
"tokens": [
{
"token": "string",
"provider_key": "firebase-fcm",
"expiry_date": "string",
"properties": {},
"device": {
"app_id": "abc-123",
"ad_id": "abc-123",
"device_id": "abc-123",
"platform": "string",
"manufacturer": "string",
"model": "string"
},
"tracking": {
"os_version": "string",
"ip": "string",
"lat": "string",
"long": "string"
}
}
]
}{
"message": "Example message text",
"type": "invalid_request_error"
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
The user's ID. This can be any uniquely identifiable string.
Response
A list of tokens registered with the user.
Show child attributes
Show child attributes
⌘I