Skip to main content
PATCH
/
v0
/
costs
/
{id}
Update
curl --request PATCH \
  --url https://api.paygentic.io/v0/costs/{id} \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "name": "<string>",
  "unitCost": 1,
  "currency": "<string>",
  "unit": "<string>",
  "aggregation": "SUM",
  "eventType": "<string>",
  "valueProperty": "<string>",
  "groupBy": {}
}
'
{
  "id": "<string>",
  "object": "cost",
  "type": "metered",
  "name": "<string>",
  "currency": "<string>",
  "unitCost": "<string>",
  "productId": "<string>",
  "merchantId": "<string>",
  "createdAt": "2023-11-07T05:31:56Z",
  "updatedAt": "2023-11-07T05:31:56Z",
  "unit": "<string>",
  "aggregation": "SUM",
  "eventType": "<string>",
  "valueProperty": "<string>",
  "groupBy": {},
  "deletedAt": "2023-11-07T05:31:56Z"
}

Authorizations

Authorization
string
header
required

API key authentication

Path Parameters

id
string
required

The unique identifier of the cost Unique identifier for a cost

Pattern: ^cst_[a-zA-Z0-9]+$

Body

application/json
name
string

Updated name for the cost.

unitCost
number

Updated unit cost.

Required range: x >= 0
currency
string

Updated ISO 4217 currency code.

unit
string | null

Updated unit label (metered costs only).

aggregation
enum<string> | null

Updated aggregation method (metered costs only).

Available options:
SUM,
COUNT,
AVG,
MIN,
MAX,
UNIQUE_COUNT,
LATEST
eventType
string | null

Updated CloudEvents type (metered costs only).

valueProperty
string | null

Updated JSONPath for value extraction (metered costs only).

groupBy
object

Updated group-by dimension map (metered costs only).

Response

Cost updated successfully

id
string
required

Unique identifier for a cost

Pattern: ^cst_[a-zA-Z0-9]+$
object
enum<string>
default:cost
required
Available options:
cost
type
enum<string>
required
Available options:
metered
name
string
required
currency
string
required
unitCost
string
required

Decimal as string to avoid floating point precision loss.

productId
string
required

Unique identifier for a product

Pattern: ^prod_[a-zA-Z0-9]+$
merchantId
string
required

Unique identifier for an organization

Pattern: ^org_[a-zA-Z0-9]+$
createdAt
string<date-time>
required
updatedAt
string<date-time>
required
unit
string | null
aggregation
enum<string> | null
Available options:
SUM,
COUNT,
AVG,
MIN,
MAX,
UNIQUE_COUNT,
LATEST
eventType
string | null
valueProperty
string | null
groupBy
object
deletedAt
string<date-time> | null

Soft-delete timestamp. Always null for active costs returned by the API.