Create custom currency

Create a custom currency.
This operation allows defining your own custom currency for billing purposes.

post

Body

application/json

CreateCurrencyCustomRequest

CurrencyCustom create request.

namestringrequired

The name of the currency. It should be a human-readable string that represents the name of the currency, such as “US Dollar” or “Euro”.

>= 1 characters<= 256 characters

descriptionstring

Description of the currency.

>= 1 characters<= 256 characters

symbolstring

The symbol of the currency. It should be a string that represents the symbol of the currency, such as “$” for US Dollar or “€” for Euro.

>= 1 characters

codestringrequired

Custom currency code.
It should be a unique code but not conflicting with any existing fiat currency codes.

>= 3 characters<= 24 characters

Response

application/json

CurrencyCustom created response.

BillingCurrencyCustom

Describes custom currency.

idstringrequiredread-only

ULID (Universally Unique Lexicographically Sortable Identifier).

Match pattern:^[0-7][0-9A-HJKMNP-TV-Z]{25}$

Example:01G65Z755AFWAKHE12NY0CQ9FH

typestringrequiredread-only

The type of the currency.

Allowed values:custom

namestringrequired

The name of the currency. It should be a human-readable string that represents the name of the currency, such as “US Dollar” or “Euro”.

>= 1 characters<= 256 characters

descriptionstring

Description of the currency.

>= 1 characters<= 256 characters

symbolstring

The symbol of the currency. It should be a string that represents the symbol of the currency, such as “$” for US Dollar or “€” for Euro.

>= 1 characters

codestringrequired

Custom currency code.
It should be a unique code but not conflicting with any existing fiat currency codes.

>= 3 characters<= 24 characters

created_atstring(date-time)read-only

An ISO-8601 timestamp representation of the custom currency creation date.

Example:2023-01-01T01:01:01.001Z

post/openmeter/currencies/custom

Body

{ "name": "name", "code": "code" }
 
application/json

List cost bases

List cost bases for a currency.
For custom currencies, there can be multiple cost bases with different effective_from dates.

get

Query Parameters

filterobject

Filter options for listing cost bases.

Show Child Parameters
pageobject

Determines which page of the collection to retrieve.

Show Child Parameters

Path Parameters

currencyIdstringrequired

ULID (Universally Unique Lexicographically Sortable Identifier).

Match pattern:^[0-7][0-9A-HJKMNP-TV-Z]{25}$

Example:01G65Z755AFWAKHE12NY0CQ9FH

Response

application/json

Page paginated response.

CostBasisPagePaginatedResponse

Page paginated response.

dataarray[object]required

Describes currency basis supported by billing system.

Show Child Parameters
metaobjectrequired

returns the pagination information

Show Child Parameters
get/openmeter/currencies/custom/{currencyId}/cost-bases
 
application/json

Create cost basis

Create a cost basis for a currency.

post

Path Parameters

currencyIdstringrequired

ULID (Universally Unique Lexicographically Sortable Identifier).

Match pattern:^[0-7][0-9A-HJKMNP-TV-Z]{25}$

Example:01G65Z755AFWAKHE12NY0CQ9FH

Body

application/json

CreateCostBasisRequest

CostBasis create request.

fiat_codestringrequired

The fiat currency code for the cost basis.

Match pattern:^[A-Z]{3}$

>= 3 characters<= 3 characters

Example:USD

ratestringrequired

The cost rate for the currency.

Match pattern:^\-?[0-9]+(\.[0-9]+)?$

effective_fromstring(date-time)

An ISO-8601 timestamp representation of the date from which the cost basis is effective.
If not provided, it will be effective immediately and will set to now by the system.

Example:2023-01-01T01:01:01.001Z

Response

application/json

CostBasis created response.

BillingCostBasis

Describes currency basis supported by billing system.

idstringrequiredread-only

ULID (Universally Unique Lexicographically Sortable Identifier).

Match pattern:^[0-7][0-9A-HJKMNP-TV-Z]{25}$

Example:01G65Z755AFWAKHE12NY0CQ9FH

fiat_codestringrequired

The fiat currency code for the cost basis.

Match pattern:^[A-Z]{3}$

>= 3 characters<= 3 characters

Example:USD

ratestringrequired

The cost rate for the currency.

Match pattern:^\-?[0-9]+(\.[0-9]+)?$

effective_fromstring(date-time)

An ISO-8601 timestamp representation of the date from which the cost basis is effective.
If not provided, it will be effective immediately and will set to now by the system.

Example:2023-01-01T01:01:01.001Z

created_atstring(date-time)read-only

An ISO-8601 timestamp representation of entity creation date.

Example:2023-01-01T01:01:01.001Z

post/openmeter/currencies/custom/{currencyId}/cost-bases

Body

{ "fiat_code": "USD", "rate": "rate" }
 
application/json

Meters

Meters specify how to aggregate events for billing and analytics purposes. Meters can be configured with multiple aggregation methods and groupings. Multiple meters can be created for the same event type, enabling flexible metering scenarios.

Query meter

Query a meter for usage.

post

Path Parameters

meterIdstringrequired

ULID (Universally Unique Lexicographically Sortable Identifier).

Match pattern:^[0-7][0-9A-HJKMNP-TV-Z]{25}$

Example:01G65Z755AFWAKHE12NY0CQ9FH

Body

application/json

MeterQueryRequest

A meter query request.

fromstring(date-time)

The start of the period the usage is queried from.

Example:2023-01-01T01:01:01.001Z

tostring(date-time)

The end of the period the usage is queried to.

Example:2023-01-01T01:01:01.001Z

granularitystring

The size of the time buckets to group the usage into.
If not specified, the usage is aggregated over the entire period.

Allowed values:PT1MPT1HP1DP1M

time_zonestring

The value is the name of the time zone as defined in the IANA Time Zone Database (http://www.iana.org/time-zones).
The time zone is used to determine the start and end of the time buckets.
If not specified, the UTC timezone will be used.

Default:UTC

group_by_dimensionsarray[string]

The dimensions to group the results by.

<= 100 items

Example:["model","type"]

filtersobject

Filters to apply to the query.

Show Child Parameters

Response

application/json

The request has succeeded.

MeterQueryResult

Meter query result.

fromstring(date-time)

The start of the period the usage is queried from.

Example:2023-01-01T01:01:01.001Z

tostring(date-time)

The end of the period the usage is queried to.

Example:2023-01-01T01:01:01.001Z

dataarray[object]required

A row in the result of a meter query.

Example:{"value":"12.3456","from":"2023-01-01T00:00:00Z","to":"2023-01-02T00:00:00Z","dimensions":{"customer_id":"01G65Z755AFWAKHE12NY0CQ9FH","model":"gpt-4-turbo","type":"input"}}

Show Child Parameters
post/openmeter/meters/{meterId}

Body

{ "from": "2023-01-01T00:00:00Z", "to": "2023-01-02T00:00:00Z", "granularity": "P1D", "time_zone": "UTC" }
 
application/json