JavaScript
import Courier from '@trycourier/courier';
const client = new Courier({
apiKey: process.env['COURIER_API_KEY'], // This is the default and can be omitted
});
await client.users.tokens.update('token', {
user_id: 'user_id',
patch: [{ op: 'op', path: 'path' }],
});import os
from courier import Courier
client = Courier(
api_key=os.environ.get("COURIER_API_KEY"), # This is the default and can be omitted
)
client.users.tokens.update(
token="token",
user_id="user_id",
patch=[{
"op": "op",
"path": "path",
}],
)package main
import (
"context"
"github.com/trycourier/courier-go"
"github.com/trycourier/courier-go/option"
)
func main() {
client := courier.NewClient(
option.WithAPIKey("My API Key"),
)
err := client.Users.Tokens.Update(
context.TODO(),
"token",
courier.UserTokenUpdateParams{
UserID: "user_id",
Patch: []courier.UserTokenUpdateParamsPatch{{
Op: "op",
Path: "path",
}},
},
)
if err != nil {
panic(err.Error())
}
}package com.courier.example;
import com.courier.client.CourierClient;
import com.courier.client.okhttp.CourierOkHttpClient;
import com.courier.models.users.tokens.TokenUpdateParams;
public final class Main {
private Main() {}
public static void main(String[] args) {
CourierClient client = CourierOkHttpClient.fromEnv();
TokenUpdateParams params = TokenUpdateParams.builder()
.userId("user_id")
.token("token")
.addPatch(TokenUpdateParams.Patch.builder()
.op("op")
.path("path")
.build())
.build();
client.users().tokens().update(params);
}
}require "courier"
courier = Courier::Client.new(api_key: "My API Key")
result = courier.users.tokens.update("token", user_id: "user_id", patch: [{op: "op", path: "path"}])
puts(result)<?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 {
$result = $client->users->tokens->update(
'token',
userID: 'user_id',
patch: [['op' => 'op', 'path' => 'path', 'value' => 'value']],
);
var_dump($result);
} catch (APIException $e) {
echo $e->getMessage();
}using TryCourier;
using TryCourier.Models.Users.Tokens;
CourierClient client = new();
TokenUpdateParams parameters = new()
{
UserID = "user_id",
Token = "token",
Patch =
[
new()
{
Op = "op",
Path = "path",
Value = "value",
},
],
};
await client.Users.Tokens.Update(parameters);courier users:tokens update \
--api-key 'My API Key' \
--user-id user_id \
--token token \
--patch '{op: op, path: path}'curl --request PATCH \
--url https://api.courier.com/users/{user_id}/tokens/{token} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"patch": [
{
"op": "<string>",
"path": "<string>",
"value": "<string>"
}
]
}
'{
"message": "Example message text",
"type": "invalid_request_error"
}Device Tokens
Update a token
Apply a JSON Patch (RFC 6902) to the specified token.
PATCH
/
users
/
{user_id}
/
tokens
/
{token}
JavaScript
import Courier from '@trycourier/courier';
const client = new Courier({
apiKey: process.env['COURIER_API_KEY'], // This is the default and can be omitted
});
await client.users.tokens.update('token', {
user_id: 'user_id',
patch: [{ op: 'op', path: 'path' }],
});import os
from courier import Courier
client = Courier(
api_key=os.environ.get("COURIER_API_KEY"), # This is the default and can be omitted
)
client.users.tokens.update(
token="token",
user_id="user_id",
patch=[{
"op": "op",
"path": "path",
}],
)package main
import (
"context"
"github.com/trycourier/courier-go"
"github.com/trycourier/courier-go/option"
)
func main() {
client := courier.NewClient(
option.WithAPIKey("My API Key"),
)
err := client.Users.Tokens.Update(
context.TODO(),
"token",
courier.UserTokenUpdateParams{
UserID: "user_id",
Patch: []courier.UserTokenUpdateParamsPatch{{
Op: "op",
Path: "path",
}},
},
)
if err != nil {
panic(err.Error())
}
}package com.courier.example;
import com.courier.client.CourierClient;
import com.courier.client.okhttp.CourierOkHttpClient;
import com.courier.models.users.tokens.TokenUpdateParams;
public final class Main {
private Main() {}
public static void main(String[] args) {
CourierClient client = CourierOkHttpClient.fromEnv();
TokenUpdateParams params = TokenUpdateParams.builder()
.userId("user_id")
.token("token")
.addPatch(TokenUpdateParams.Patch.builder()
.op("op")
.path("path")
.build())
.build();
client.users().tokens().update(params);
}
}require "courier"
courier = Courier::Client.new(api_key: "My API Key")
result = courier.users.tokens.update("token", user_id: "user_id", patch: [{op: "op", path: "path"}])
puts(result)<?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 {
$result = $client->users->tokens->update(
'token',
userID: 'user_id',
patch: [['op' => 'op', 'path' => 'path', 'value' => 'value']],
);
var_dump($result);
} catch (APIException $e) {
echo $e->getMessage();
}using TryCourier;
using TryCourier.Models.Users.Tokens;
CourierClient client = new();
TokenUpdateParams parameters = new()
{
UserID = "user_id",
Token = "token",
Patch =
[
new()
{
Op = "op",
Path = "path",
Value = "value",
},
],
};
await client.Users.Tokens.Update(parameters);courier users:tokens update \
--api-key 'My API Key' \
--user-id user_id \
--token token \
--patch '{op: op, path: path}'curl --request PATCH \
--url https://api.courier.com/users/{user_id}/tokens/{token} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"patch": [
{
"op": "<string>",
"path": "<string>",
"value": "<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.
The full token string.
Body
application/json
Show child attributes
Show child attributes
Response
⌘I