> 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.iot.telia.lt/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.iot.telia.lt/_mcp/server.

# Update a SIM

PATCH https://iot.telia.lt/api/v1/sim/{sim_id}
Content-Type: application/json

Updates a SIM resource.

You can provide the following fields with this request:

* `issuer_org` (Object optional) - change to a direct child organization of the appropriate type
* `reseller_org` (Object optional) - change to a direct child organization of the appropriate type or empty (`"reseller_org": { "id": null }` or `"reseller_org": {}`)
* `customer_org` (Object optional) - change to own organization or a direct child organization of type "Enterprise" or empty (`"customer_org": { "id": null }` or `"customer_org": {}`)
* `status` (Object optional) - update the SIM status

The following restrictions apply when updating SIMs:

* Users from the issuer organization can change any updatable field
* Users from the reseller organization can update the `reseller_org` or `customer_org` fields
* Users from the customer organization can only update the `status` field
* `issuer_org` can change to a child organization of the type "Mobile Network Operator" or "Service Provider"
* `reseller_org` can change to child organization of the following types: "Mobile Network Operator", "Service Provider", or "Reseller"
* `customer_org` can change to a child organization of an "Enterprise" type
* `status` can update from "Issued" (`"id": 0`) to either "Activated" (`"id": 1`) or "Factory Test" (`"id": 4`)
* `status` can only update from "Factory Test" (`"id": 4`) to "Activated" (`"id": 1`)
* `status` can switch between "Activated" (`"id": 1`) and "Suspended" (`"id": 2`)

Telia charges for activated SIMs. To avoid accruing unexpected charges, update the SIM `status` to "Suspended" (`"id": 2`).

Reference: https://docs.iot.telia.lt/developers/api/sim/sim-by-id-patch

## 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

- `sim_id` (integer, required) — Numeric ID of a SIM

### Body (application/json)

This endpoint expects an object.

- `issuer_org` (ApiV1SimSimIdPatchRequestBodyContentApplicationJsonSchemaIssuerOrg, required)
- `reseller_org` (ApiV1SimSimIdPatchRequestBodyContentApplicationJsonSchemaResellerOrg, required)
- `customer_org` (ApiV1SimSimIdPatchRequestBodyContentApplicationJsonSchemaCustomerOrg, required)
- `status` (ApiV1SimSimIdPatchRequestBodyContentApplicationJsonSchemaStatus, required)

## Response

### 204

Successfully fulfilled the request with no additional content to send in the response payload body.

## Errors

### 400 Bad Request Error

Unexpected error in the API call. See the HTTP response body for details.

- `error_code` (integer, optional)
- `error_token` (string, 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)

## Types

### ApiV1SimSimIdPatchRequestBodyContentApplicationJsonSchemaIssuerOrg

- `id` (integer, optional)

### ApiV1SimSimIdPatchRequestBodyContentApplicationJsonSchemaResellerOrg

- `id` (integer, optional)

### ApiV1SimSimIdPatchRequestBodyContentApplicationJsonSchemaCustomerOrg

- `id` (integer, optional)

### ApiV1SimSimIdPatchRequestBodyContentApplicationJsonSchemaStatus

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

## Examples

**Request**

```json
{
  "issuer_org": {
    "id": 3
  },
  "reseller_org": {
    "id": 5
  },
  "customer_org": {
    "id": 12
  },
  "status": {
    "id": 2
  }
}
```

**SDK Code**

```python
import requests

url = "https://iot.telia.lt/api/v1/sim/1"

payload = {
    "issuer_org": { "id": 3 },
    "reseller_org": { "id": 5 },
    "customer_org": { "id": 12 },
    "status": { "id": 2 }
}
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript
const url = 'https://iot.telia.lt/api/v1/sim/1';
const options = {
  method: 'PATCH',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{"issuer_org":{"id":3},"reseller_org":{"id":5},"customer_org":{"id":12},"status":{"id":2}}'
};

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

```go
package main

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

func main() {

	url := "https://iot.telia.lt/api/v1/sim/1"

	payload := strings.NewReader("{\n  \"issuer_org\": {\n    \"id\": 3\n  },\n  \"reseller_org\": {\n    \"id\": 5\n  },\n  \"customer_org\": {\n    \"id\": 12\n  },\n  \"status\": {\n    \"id\": 2\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
require 'uri'
require 'net/http'

url = URI("https://iot.telia.lt/api/v1/sim/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  \"issuer_org\": {\n    \"id\": 3\n  },\n  \"reseller_org\": {\n    \"id\": 5\n  },\n  \"customer_org\": {\n    \"id\": 12\n  },\n  \"status\": {\n    \"id\": 2\n  }\n}"

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

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.patch("https://iot.telia.lt/api/v1/sim/1")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"issuer_org\": {\n    \"id\": 3\n  },\n  \"reseller_org\": {\n    \"id\": 5\n  },\n  \"customer_org\": {\n    \"id\": 12\n  },\n  \"status\": {\n    \"id\": 2\n  }\n}")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('PATCH', 'https://iot.telia.lt/api/v1/sim/1', [
  'body' => '{
  "issuer_org": {
    "id": 3
  },
  "reseller_org": {
    "id": 5
  },
  "customer_org": {
    "id": 12
  },
  "status": {
    "id": 2
  }
}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

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

```csharp
using RestSharp;

var client = new RestClient("https://iot.telia.lt/api/v1/sim/1");
var request = new RestRequest(Method.PATCH);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"issuer_org\": {\n    \"id\": 3\n  },\n  \"reseller_org\": {\n    \"id\": 5\n  },\n  \"customer_org\": {\n    \"id\": 12\n  },\n  \"status\": {\n    \"id\": 2\n  }\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = [
  "issuer_org": ["id": 3],
  "reseller_org": ["id": 5],
  "customer_org": ["id": 12],
  "status": ["id": 2]
] as [String : Any]

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

let request = NSMutableURLRequest(url: NSURL(string: "https://iot.telia.lt/api/v1/sim/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()
```