> This page is for Developers.

> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.emnify.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.emnify.com/_mcp/server.

# Update an application token

PATCH https://cdn.emnify.net/api/v2/application_token/{id}
Content-Type: application/json

Required permissions Beta [Learn more](/developers/api-guidelines/permissions#how-permissions-work)`ApplicationToken` + `Update` [+1 endpoint](/developers/api-guidelines/permission-endpoints#permission-applicationtoken-update "This permission also grants 1 other endpoint")Roles: AdministratorChanges the name and/or the role of an application token.Omitted fields keep their current value.
Expiry date and IP restrictions are fixed for the life of a token.To revoke a token, use DELETE `/api/v2/application_token/{id}`.
A `status` field in the request body is ignored.

Reference: https://docs.emnify.com/developers/api/application-tokens/update-application-token

## Authentication

- `Authorization` header (bearer token, required) — An `auth_token` should be provided to authenticate a session. To obtain an `auth_token`, see the [`/api/v1/authenticate` **POST** request](/developers/api/authentication/authenticate).

## Request

### Path parameters

- `id` (integer, required) — The id of the application token.

### Body (application/json)

This endpoint expects an object.

- `name` (string, optional) — Name of the application token. Letters, digits, spaces and - _ . : / ( ) [ ] @ + # are allowed.
- `roles` (list of ApiV2ApplicationTokenIdPatchRequestBodyContentApplicationJsonSchemaRolesItems, optional) — The role granted to the token. Exactly one role is assigned, and the Support role can't be assigned to a token.

## Response

### 200

Application token updated

- `id` (integer, required) — Unique ID of this application token.
- `name` (string, required)
- `status` (ApplicationTokenV2Status, required)
- `roles` (list of ApplicationTokenV2RolesItems, required) — The role granted to the token.
- `created_date` (string, required)
- `ip_restrictions` (list of ApplicationTokenV2IpRestrictionsItems, optional) — IP addresses the token may connect from. Absent where it may connect from any.
- `expiry_date` (string, optional) — Absent for a token created without one through the v1 API.
- `last_used_date` (string, optional) — Absent until the token has been used.
- `last_used_ip` (string, optional) — IP address the token was last used from.
- `created_by` (ApplicationTokenV2Actor, optional) — A user that acted on the token. Absent where an application token acted instead.
- `last_modified_date` (string, optional) — Absent until the token has been modified.
- `last_modified_by` (ApplicationTokenV2Actor, optional) — A user that acted on the token. Absent where an application token acted instead.
- `deleted_date` (string, optional) — Set only once the token has been deleted.
- `deleted_by` (ApplicationTokenV2Actor, optional) — A user that acted on the token. Absent where an application token acted instead.

## Errors

### 400 Bad Request Error

The payload is invalid or changes nothing, or the organisation is not enabled. See HTTP response body for details.

- `status_code` (integer, optional)
- `message` (string, optional)

### 403 Forbidden Error

Your role doesn't include the permission this endpoint requires. Most endpoints return `error_code`, `error_token`, and `message`. Some return only `status_code` and `message`.

- `error_code` (integer, optional)
- `error_token` (string, optional)
- `status_code` (integer, optional)
- `message` (string, optional)

### 404 Not Found Error

Application token does not exist or is not accessible.

- `status_code` (integer, optional)
- `message` (string, optional)

## Types

### ApiV2ApplicationTokenIdPatchRequestBodyContentApplicationJsonSchemaRolesItems

- `id` (integer, required)

### ApplicationTokenV2Status

- `id` (integer, optional)
- `description` (string, optional)

### ApplicationTokenV2RolesItems

- `id` (integer, optional)
- `name` (string, optional)

### ApplicationTokenV2IpRestrictionsItems

- `id` (integer, optional)
- `ip_address` (string, optional) — An IP address in CIDR notation.

### ApplicationTokenV2Actor

A user that acted on the token. Absent where an application token acted instead.

- `id` (integer, required)
- `username` (string, required)
- `type` (ApplicationTokenV2ActorType, required)
- `name` (string, optional)

### ApplicationTokenV2ActorType

- `id` (integer, optional)
- `description` (string, optional)

## Examples

### Application token updated

**Response**

```json
{
  "id": 1234,
  "name": "CI pipeline token",
  "status": {
    "id": 1,
    "description": "ACTIVE"
  },
  "roles": [
    {
      "id": 3,
      "name": "Observer"
    }
  ],
  "created_date": "2026-08-21T10:00:00.000Z",
  "expiry_date": "2027-08-21T10:00:00.000Z",
  "last_modified_date": "2026-08-24T09:15:00.000Z",
  "last_modified_by": {
    "id": 10,
    "username": "john.doe@example.com",
    "type": {
      "id": 0,
      "description": "HUMAN"
    },
    "name": "John Doe"
  }
}
```

**SDK Code**

```python Application token updated
import requests

url = "https://cdn.emnify.net/api/v2/application_token/1"

headers = {"Authorization": "Bearer <token>"}

response = requests.patch(url, headers=headers)

print(response.json())
```

```javascript Application token updated
const url = 'https://cdn.emnify.net/api/v2/application_token/1';
const options = {method: 'PATCH', headers: {Authorization: 'Bearer <token>'}};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Application token updated
package main

import (
	"fmt"
	"net/http"
	"io"
)

func main() {

	url := "https://cdn.emnify.net/api/v2/application_token/1"

	req, _ := http.NewRequest("PATCH", url, nil)

	req.Header.Add("Authorization", "Bearer <token>")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby Application token updated
require 'uri'
require 'net/http'

url = URI("https://cdn.emnify.net/api/v2/application_token/1")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'

response = http.request(request)
puts response.read_body
```

```java Application token updated
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.patch("https://cdn.emnify.net/api/v2/application_token/1")
  .header("Authorization", "Bearer <token>")
  .asString();
```

```php Application token updated
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('PATCH', 'https://cdn.emnify.net/api/v2/application_token/1', [
  'headers' => [
    'Authorization' => 'Bearer <token>',
  ],
]);

echo $response->getBody();
```

```csharp Application token updated
using RestSharp;

var client = new RestClient("https://cdn.emnify.net/api/v2/application_token/1");
var request = new RestRequest(Method.PATCH);
request.AddHeader("Authorization", "Bearer <token>");
IRestResponse response = client.Execute(request);
```

```swift Application token updated
import Foundation

let headers = ["Authorization": "Bearer <token>"]

let request = NSMutableURLRequest(url: NSURL(string: "https://cdn.emnify.net/api/v2/application_token/1")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "PATCH"
request.allHTTPHeaderFields = headers

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```

### Change the name

**Request**

```json
{
  "name": "CI pipeline token"
}
```

**Response**

```json
{
  "id": 1234,
  "name": "CI pipeline token",
  "status": {
    "id": 1,
    "description": "ACTIVE"
  },
  "roles": [
    {
      "id": 3,
      "name": "Observer"
    }
  ],
  "created_date": "2026-08-21T10:00:00.000Z",
  "expiry_date": "2027-08-21T10:00:00.000Z",
  "last_modified_date": "2026-08-24T09:15:00.000Z",
  "last_modified_by": {
    "id": 10,
    "username": "john.doe@example.com",
    "type": {
      "id": 0,
      "description": "HUMAN"
    },
    "name": "John Doe"
  }
}
```

**SDK Code**

```python Change the name
import requests

url = "https://cdn.emnify.net/api/v2/application_token/1"

payload = { "name": "CI pipeline token" }
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

response = requests.patch(url, json=payload, headers=headers)

print(response.json())
```

```javascript Change the name
const url = 'https://cdn.emnify.net/api/v2/application_token/1';
const options = {
  method: 'PATCH',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{"name":"CI pipeline token"}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Change the name
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://cdn.emnify.net/api/v2/application_token/1"

	payload := strings.NewReader("{\n  \"name\": \"CI pipeline token\"\n}")

	req, _ := http.NewRequest("PATCH", 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(res)
	fmt.Println(string(body))

}
```

```ruby Change the name
require 'uri'
require 'net/http'

url = URI("https://cdn.emnify.net/api/v2/application_token/1")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"name\": \"CI pipeline token\"\n}"

response = http.request(request)
puts response.read_body
```

```java Change the name
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.patch("https://cdn.emnify.net/api/v2/application_token/1")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"name\": \"CI pipeline token\"\n}")
  .asString();
```

```php Change the name
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('PATCH', 'https://cdn.emnify.net/api/v2/application_token/1', [
  'body' => '{
  "name": "CI pipeline token"
}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

echo $response->getBody();
```

```csharp Change the name
using RestSharp;

var client = new RestClient("https://cdn.emnify.net/api/v2/application_token/1");
var request = new RestRequest(Method.PATCH);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"name\": \"CI pipeline token\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Change the name
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = ["name": "CI pipeline token"] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://cdn.emnify.net/api/v2/application_token/1")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "PATCH"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```

### Change the role

**Request**

```json
{
  "roles": [
    {
      "id": 3
    }
  ]
}
```

**Response**

```json
{
  "id": 1234,
  "name": "CI pipeline token",
  "status": {
    "id": 1,
    "description": "ACTIVE"
  },
  "roles": [
    {
      "id": 3,
      "name": "Observer"
    }
  ],
  "created_date": "2026-08-21T10:00:00.000Z",
  "expiry_date": "2027-08-21T10:00:00.000Z",
  "last_modified_date": "2026-08-24T09:15:00.000Z",
  "last_modified_by": {
    "id": 10,
    "username": "john.doe@example.com",
    "type": {
      "id": 0,
      "description": "HUMAN"
    },
    "name": "John Doe"
  }
}
```

**SDK Code**

```python Change the role
import requests

url = "https://cdn.emnify.net/api/v2/application_token/1"

payload = { "roles": [{ "id": 3 }] }
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

response = requests.patch(url, json=payload, headers=headers)

print(response.json())
```

```javascript Change the role
const url = 'https://cdn.emnify.net/api/v2/application_token/1';
const options = {
  method: 'PATCH',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{"roles":[{"id":3}]}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Change the role
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://cdn.emnify.net/api/v2/application_token/1"

	payload := strings.NewReader("{\n  \"roles\": [\n    {\n      \"id\": 3\n    }\n  ]\n}")

	req, _ := http.NewRequest("PATCH", 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(res)
	fmt.Println(string(body))

}
```

```ruby Change the role
require 'uri'
require 'net/http'

url = URI("https://cdn.emnify.net/api/v2/application_token/1")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"roles\": [\n    {\n      \"id\": 3\n    }\n  ]\n}"

response = http.request(request)
puts response.read_body
```

```java Change the role
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.patch("https://cdn.emnify.net/api/v2/application_token/1")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"roles\": [\n    {\n      \"id\": 3\n    }\n  ]\n}")
  .asString();
```

```php Change the role
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('PATCH', 'https://cdn.emnify.net/api/v2/application_token/1', [
  'body' => '{
  "roles": [
    {
      "id": 3
    }
  ]
}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

echo $response->getBody();
```

```csharp Change the role
using RestSharp;

var client = new RestClient("https://cdn.emnify.net/api/v2/application_token/1");
var request = new RestRequest(Method.PATCH);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"roles\": [\n    {\n      \"id\": 3\n    }\n  ]\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Change the role
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = ["roles": [["id": 3]]] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://cdn.emnify.net/api/v2/application_token/1")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "PATCH"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```

### Change the name and the role

**Request**

```json
{
  "name": "CI pipeline token",
  "roles": [
    {
      "id": 3
    }
  ]
}
```

**Response**

```json
{
  "id": 1234,
  "name": "CI pipeline token",
  "status": {
    "id": 1,
    "description": "ACTIVE"
  },
  "roles": [
    {
      "id": 3,
      "name": "Observer"
    }
  ],
  "created_date": "2026-08-21T10:00:00.000Z",
  "expiry_date": "2027-08-21T10:00:00.000Z",
  "last_modified_date": "2026-08-24T09:15:00.000Z",
  "last_modified_by": {
    "id": 10,
    "username": "john.doe@example.com",
    "type": {
      "id": 0,
      "description": "HUMAN"
    },
    "name": "John Doe"
  }
}
```

**SDK Code**

```python Change the name and the role
import requests

url = "https://cdn.emnify.net/api/v2/application_token/1"

payload = {
    "name": "CI pipeline token",
    "roles": [{ "id": 3 }]
}
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

response = requests.patch(url, json=payload, headers=headers)

print(response.json())
```

```javascript Change the name and the role
const url = 'https://cdn.emnify.net/api/v2/application_token/1';
const options = {
  method: 'PATCH',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{"name":"CI pipeline token","roles":[{"id":3}]}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Change the name and the role
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://cdn.emnify.net/api/v2/application_token/1"

	payload := strings.NewReader("{\n  \"name\": \"CI pipeline token\",\n  \"roles\": [\n    {\n      \"id\": 3\n    }\n  ]\n}")

	req, _ := http.NewRequest("PATCH", 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(res)
	fmt.Println(string(body))

}
```

```ruby Change the name and the role
require 'uri'
require 'net/http'

url = URI("https://cdn.emnify.net/api/v2/application_token/1")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"name\": \"CI pipeline token\",\n  \"roles\": [\n    {\n      \"id\": 3\n    }\n  ]\n}"

response = http.request(request)
puts response.read_body
```

```java Change the name and the role
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.patch("https://cdn.emnify.net/api/v2/application_token/1")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"name\": \"CI pipeline token\",\n  \"roles\": [\n    {\n      \"id\": 3\n    }\n  ]\n}")
  .asString();
```

```php Change the name and the role
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('PATCH', 'https://cdn.emnify.net/api/v2/application_token/1', [
  'body' => '{
  "name": "CI pipeline token",
  "roles": [
    {
      "id": 3
    }
  ]
}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

echo $response->getBody();
```

```csharp Change the name and the role
using RestSharp;

var client = new RestClient("https://cdn.emnify.net/api/v2/application_token/1");
var request = new RestRequest(Method.PATCH);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"name\": \"CI pipeline token\",\n  \"roles\": [\n    {\n      \"id\": 3\n    }\n  ]\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Change the name and the role
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = [
  "name": "CI pipeline token",
  "roles": [["id": 3]]
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://cdn.emnify.net/api/v2/application_token/1")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "PATCH"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```