cURL
curl -X PUT "$EXSITED_BASE_URL/api/v4/usages/usg_3e7a1c9b5d2f4a6e8c0b1d3f5a7c9e2b" \
-H "Authorization: Bearer $ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"usage": {
"quantity": 4,
"start_time": "2026-10-01T09:00:00Z",
"end_time": "2026-10-01T09:05:00Z",
"custom_attributes": []
}
}'from exsited import build_client
client = build_client()
response = client.usages.replace_usage(
"usg_3e7a1c9b5d2f4a6e8c0b1d3f5a7c9e2b",
{
"usage": {
"quantity": 4,
"start_time": "2026-10-01T09:00:00Z",
"end_time": "2026-10-01T09:05:00Z",
"custom_attributes": [],
}
},
)
print(response.data)
import {buildClient} from 'exsited';
const client = await buildClient();
const response = await client.usages.replaceUsage('usg_3e7a1c9b5d2f4a6e8c0b1d3f5a7c9e2b', {
usage: {quantity: 4, start_time: '2026-10-01T09:00:00Z', end_time: '2026-10-01T09:05:00Z', custom_attributes: []},
});
console.log(response.data);
use Exsited\Client\ClientRegistry;
$client = ClientRegistry::buildClient();
$response = $client->usages->replaceUsage('usg_3e7a1c9b5d2f4a6e8c0b1d3f5a7c9e2b', [
'usage' => [
'quantity' => 4,
'start_time' => '2026-10-01T09:00:00Z',
'end_time' => '2026-10-01T09:05:00Z',
'custom_attributes' => [],
],
]);
print_r($response->data);
import com.exsited.client.ApiResponse;
import com.exsited.client.ClientRegistry;
import com.exsited.client.ExsitedClient;
import com.exsited.resources.usages.usages_dto.UsagesDto.UsageUpdated;
import java.util.List;
import java.util.Map;
ExsitedClient client = ClientRegistry.buildClient();
ApiResponse<UsageUpdated> response = client.usages().replaceUsage(
"usg_3e7a1c9b5d2f4a6e8c0b1d3f5a7c9e2b",
Map.of(
"usage", Map.of(
"quantity", 4,
"start_time", "2026-10-01T09:00:00Z",
"end_time", "2026-10-01T09:05:00Z",
"custom_attributes", List.of())));
System.out.println(response.getMap());
using Exsited.Client;
await using var client = ExsitedClient.BuildClient();
var response = await client.Usages.ReplaceUsageAsync(
"usg_3e7a1c9b5d2f4a6e8c0b1d3f5a7c9e2b",
new Dictionary<string, object?>
{
["usage"] = new Dictionary<string, object?>
{
["quantity"] = 4,
["start_time"] = "2026-10-01T09:00:00Z",
["end_time"] = "2026-10-01T09:05:00Z",
["custom_attributes"] = new List<object?>(),
},
});
Console.WriteLine(response.Json);
import 'package:exsited/exsited.dart';
final client = buildClient();
final response = await client.usages.replaceUsage(
'usg_3e7a1c9b5d2f4a6e8c0b1d3f5a7c9e2b',
{
'usage': {
'quantity': 4,
'start_time': '2026-10-01T09:00:00Z',
'end_time': '2026-10-01T09:05:00Z',
'custom_attributes': [],
},
},
);
print(response.map);
import (
"context"
"fmt"
"log"
exsited "github.com/exsited/exsited-sdk-go/v4"
)
client, err := exsited.BuildClient(nil)
if err != nil {
log.Fatal(err)
}
defer client.Close()
response, err := client.Usages().ReplaceUsage(context.Background(), "usg_3e7a1c9b5d2f4a6e8c0b1d3f5a7c9e2b", map[string]any{
"usage": map[string]any{
"quantity": 4,
"start_time": "2026-10-01T09:00:00Z",
"end_time": "2026-10-01T09:05:00Z",
"custom_attributes": []any{},
},
}, nil)
if err != nil {
log.Fatal(err)
}
fmt.Println(response.Map)
{
"usage": {
"href": "<string>",
"id": "<string>",
"object": "<string>"
}
}Usages
Replace a usage
Replaces a usage’s quantity, times and custom attributes and returns a reference to it.
PUT
/
usages
/
{usage_id}
cURL
curl -X PUT "$EXSITED_BASE_URL/api/v4/usages/usg_3e7a1c9b5d2f4a6e8c0b1d3f5a7c9e2b" \
-H "Authorization: Bearer $ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"usage": {
"quantity": 4,
"start_time": "2026-10-01T09:00:00Z",
"end_time": "2026-10-01T09:05:00Z",
"custom_attributes": []
}
}'from exsited import build_client
client = build_client()
response = client.usages.replace_usage(
"usg_3e7a1c9b5d2f4a6e8c0b1d3f5a7c9e2b",
{
"usage": {
"quantity": 4,
"start_time": "2026-10-01T09:00:00Z",
"end_time": "2026-10-01T09:05:00Z",
"custom_attributes": [],
}
},
)
print(response.data)
import {buildClient} from 'exsited';
const client = await buildClient();
const response = await client.usages.replaceUsage('usg_3e7a1c9b5d2f4a6e8c0b1d3f5a7c9e2b', {
usage: {quantity: 4, start_time: '2026-10-01T09:00:00Z', end_time: '2026-10-01T09:05:00Z', custom_attributes: []},
});
console.log(response.data);
use Exsited\Client\ClientRegistry;
$client = ClientRegistry::buildClient();
$response = $client->usages->replaceUsage('usg_3e7a1c9b5d2f4a6e8c0b1d3f5a7c9e2b', [
'usage' => [
'quantity' => 4,
'start_time' => '2026-10-01T09:00:00Z',
'end_time' => '2026-10-01T09:05:00Z',
'custom_attributes' => [],
],
]);
print_r($response->data);
import com.exsited.client.ApiResponse;
import com.exsited.client.ClientRegistry;
import com.exsited.client.ExsitedClient;
import com.exsited.resources.usages.usages_dto.UsagesDto.UsageUpdated;
import java.util.List;
import java.util.Map;
ExsitedClient client = ClientRegistry.buildClient();
ApiResponse<UsageUpdated> response = client.usages().replaceUsage(
"usg_3e7a1c9b5d2f4a6e8c0b1d3f5a7c9e2b",
Map.of(
"usage", Map.of(
"quantity", 4,
"start_time", "2026-10-01T09:00:00Z",
"end_time", "2026-10-01T09:05:00Z",
"custom_attributes", List.of())));
System.out.println(response.getMap());
using Exsited.Client;
await using var client = ExsitedClient.BuildClient();
var response = await client.Usages.ReplaceUsageAsync(
"usg_3e7a1c9b5d2f4a6e8c0b1d3f5a7c9e2b",
new Dictionary<string, object?>
{
["usage"] = new Dictionary<string, object?>
{
["quantity"] = 4,
["start_time"] = "2026-10-01T09:00:00Z",
["end_time"] = "2026-10-01T09:05:00Z",
["custom_attributes"] = new List<object?>(),
},
});
Console.WriteLine(response.Json);
import 'package:exsited/exsited.dart';
final client = buildClient();
final response = await client.usages.replaceUsage(
'usg_3e7a1c9b5d2f4a6e8c0b1d3f5a7c9e2b',
{
'usage': {
'quantity': 4,
'start_time': '2026-10-01T09:00:00Z',
'end_time': '2026-10-01T09:05:00Z',
'custom_attributes': [],
},
},
);
print(response.map);
import (
"context"
"fmt"
"log"
exsited "github.com/exsited/exsited-sdk-go/v4"
)
client, err := exsited.BuildClient(nil)
if err != nil {
log.Fatal(err)
}
defer client.Close()
response, err := client.Usages().ReplaceUsage(context.Background(), "usg_3e7a1c9b5d2f4a6e8c0b1d3f5a7c9e2b", map[string]any{
"usage": map[string]any{
"quantity": 4,
"start_time": "2026-10-01T09:00:00Z",
"end_time": "2026-10-01T09:05:00Z",
"custom_attributes": []any{},
},
}, nil)
if err != nil {
log.Fatal(err)
}
fmt.Println(response.Map)
{
"usage": {
"href": "<string>",
"id": "<string>",
"object": "<string>"
}
}Send the full usage under
usage: quantity, start_time, end_time and custom_attributes. The response holds the usage’s id and href under usage.
The SDK samples get their client from credentials your app registers once when it starts, as shown in Authentication. To try the call here, click Try it, set
host to your Exsited API host name and paste an access token from Get an access token. To send a raw JSON body instead of filling in fields, copy the cURL sample and edit its -d payload.Authorizations
An access token from POST /api/v4/oauth2/token. The SDKs get and renew it for you.
Path Parameters
The usage's id.
Body
application/json
Show child attributes
Show child attributes
Response
200 - application/json
A reference to the replaced usage, under usage.
Show child attributes
Show child attributes