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

# Add data limit to service profile

POST https://iot.telia.lt/api/v1/service_profile/{profile_id}/traffic_limit
Content-Type: application/json

This API endpoint allows you to add a data limit to a service profile.
A data limit is a rule that defines how much data a service can consume within a certain period.
This is useful for managing your data usage and avoiding overage charges.

You can use this API to customize the data limit for your service profile by specifying the service type, time period, volume threshold, and warning percentage.

Only users with `User` or `Admin` roles can use this API endpoint.
Adding a data limit that already exists returns a `409` error.

To change the data limit, you must first delete the existing data limit and then add a new one.
**Exception**: Creating a temporary [traffic limit extension](/developers/api/endpoint/create-endpoint-traffic-limit-extension).

Reference: https://docs.iot.telia.lt/developers/api/service-profiles/add-service-profile-traffic-limit

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

- `profile_id` (double, required) — The Numeric ID of a Service Profile

### Body (application/json)

This endpoint expects an object.

- `service` (ApiV1ServiceProfileProfileIdTrafficLimitPostRequestBodyContentApplicationJsonSchemaService, required) — Service type to which the limit applies. The only supported service type is `Data`, which has an ID of `38`.
- `satellite_only` (boolean, required) — Which data traffic the limit counts. This field is required, even if your devices don't use satellite connectivity. If you're unsure which value to use, set it to `false`. - `false`: the limit counts data over all radio access technology (RAT) types. Use this for most data limits. - `true`: the limit only counts data over satellite RAT types. Satellite data costs more than other data, so use this to set a separate limit for it. A service profile can have one data limit with `false` and one with `true` for each service.
- `volume` (long, required) — Limit threshold in the atomic units of the service type (for data, this is bytes). This specifies the amount of data that the service can consume within the period before the limit is reached or exceeded.
- `period` (ApiV1ServiceProfileProfileIdTrafficLimitPostRequestBodyContentApplicationJsonSchemaPeriod, optional) — Period of the limit. The only supported period is `Monthly`, which uses calendar months and has an ID of `2`. The limit resets at the beginning of each month 00:00 UTC.
- `warning_percent` (integer, optional) — Percentage of the limit volume when the system sends an event. The event is sent when the limit is reached or exceeded. For example, if you set the warning percentage to `80`, the system sends an event when the service consumes 80% of the limit volume.

## Response

### 201

Created

## Errors

### 400 Bad Request Error

One or more values of the data limit are invalid

- `any`

### 403 Forbidden Error

Service Profile is not found or not accessible

- `any`

### 409 Conflict Error

Data Limit for the same traffic type and rat type combination already exists

- `any`

## Types

### ApiV1ServiceProfileProfileIdTrafficLimitPostRequestBodyContentApplicationJsonSchemaService

Service type to which the limit applies. The only supported service type is `Data`, which has an ID of `38`.

- `id` (enum, optional)
  - Allowed values: `38`

### ApiV1ServiceProfileProfileIdTrafficLimitPostRequestBodyContentApplicationJsonSchemaPeriod

Period of the limit. The only supported period is `Monthly`, which uses calendar months and has an ID of `2`. The limit resets at the beginning of each month 00:00 UTC.

- `id` (enum, optional)
  - Allowed values: `2`

## Examples

**Request**

```json
{
  "service": {
    "id": 38
  },
  "satellite_only": false,
  "volume": 100000,
  "period": {
    "id": 2
  },
  "warning_percent": 50
}
```

**Response**

```json
{}
```

**SDK Code**

```python CreateServiceProfileTrafficLimit
import requests

url = "https://iot.telia.lt/api/v1/service_profile/1.1/traffic_limit"

payload = {
    "service": { "id": 38 },
    "satellite_only": False,
    "volume": 100000,
    "period": { "id": 2 },
    "warning_percent": 50
}
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript CreateServiceProfileTrafficLimit
const url = 'https://iot.telia.lt/api/v1/service_profile/1.1/traffic_limit';
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{"service":{"id":38},"satellite_only":false,"volume":100000,"period":{"id":2},"warning_percent":50}'
};

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

```go CreateServiceProfileTrafficLimit
package main

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

func main() {

	url := "https://iot.telia.lt/api/v1/service_profile/1.1/traffic_limit"

	payload := strings.NewReader("{\n  \"service\": {\n    \"id\": 38\n  },\n  \"satellite_only\": false,\n  \"volume\": 100000,\n  \"period\": {\n    \"id\": 2\n  },\n  \"warning_percent\": 50\n}")

	req, _ := http.NewRequest("POST", 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 CreateServiceProfileTrafficLimit
require 'uri'
require 'net/http'

url = URI("https://iot.telia.lt/api/v1/service_profile/1.1/traffic_limit")

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

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"service\": {\n    \"id\": 38\n  },\n  \"satellite_only\": false,\n  \"volume\": 100000,\n  \"period\": {\n    \"id\": 2\n  },\n  \"warning_percent\": 50\n}"

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

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

HttpResponse<String> response = Unirest.post("https://iot.telia.lt/api/v1/service_profile/1.1/traffic_limit")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"service\": {\n    \"id\": 38\n  },\n  \"satellite_only\": false,\n  \"volume\": 100000,\n  \"period\": {\n    \"id\": 2\n  },\n  \"warning_percent\": 50\n}")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://iot.telia.lt/api/v1/service_profile/1.1/traffic_limit', [
  'body' => '{
  "service": {
    "id": 38
  },
  "satellite_only": false,
  "volume": 100000,
  "period": {
    "id": 2
  },
  "warning_percent": 50
}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

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

```csharp CreateServiceProfileTrafficLimit
using RestSharp;

var client = new RestClient("https://iot.telia.lt/api/v1/service_profile/1.1/traffic_limit");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"service\": {\n    \"id\": 38\n  },\n  \"satellite_only\": false,\n  \"volume\": 100000,\n  \"period\": {\n    \"id\": 2\n  },\n  \"warning_percent\": 50\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift CreateServiceProfileTrafficLimit
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = [
  "service": ["id": 38],
  "satellite_only": false,
  "volume": 100000,
  "period": ["id": 2],
  "warning_percent": 50
] as [String : Any]

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

let request = NSMutableURLRequest(url: NSURL(string: "https://iot.telia.lt/api/v1/service_profile/1.1/traffic_limit")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
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()
```