{
"error": {
"type": "invalid_request_error",
"code": "meter_name_taken",
"message": "A meter named \"Image generations\" already exists in this store",
"request_id": "req_abc123def456",
"param": "events[3].customer_id",
"details": {
"archived_holder": true,
"archived_holder_id": "mtr_abc123"
}
}
}
{
"error": {
"type": "invalid_request_error",
"code": "meter_name_taken",
"message": "A meter named \"Image generations\" already exists in this store",
"request_id": "req_abc123def456",
"param": "events[3].customer_id",
"details": {
"archived_holder": true,
"archived_holder_id": "mtr_abc123"
}
}
}
{
"error": {
"type": "invalid_request_error",
"code": "meter_name_taken",
"message": "A meter named \"Image generations\" already exists in this store",
"request_id": "req_abc123def456",
"param": "events[3].customer_id",
"details": {
"archived_holder": true,
"archived_holder_id": "mtr_abc123"
}
}
}
{
"error": {
"type": "invalid_request_error",
"code": "meter_name_taken",
"message": "A meter named \"Image generations\" already exists in this store",
"request_id": "req_abc123def456",
"param": "events[3].customer_id",
"details": {
"archived_holder": true,
"archived_holder_id": "mtr_abc123"
}
}
}
Meters
Create a meter
Define how a stream of usage events is aggregated into billable units. The unit label doubles as the display unit and as the credit bucket the meter settles into. A duplicate name within the store is rejected with 409 meter_name_taken. With an external_id the call is an upsert: it creates the meter when the key is new (201) and updates the meter that holds the key otherwise (200), archived meters included, which stay archived. Only the fields you send change, each with the meaning PATCH /v1/meters/{id} gives it; event_name and unit_label cannot change after create, and a different value is ignored with a field_not_writable warning. The request is compared with the stored meter first, so a request that changes nothing answers unchanged and writes nothing, also on a locked meter, and retrying after a timeout is safe; only a real change of a locked meter’s filter or aggregation answers 409 meter_immutable. The meter comes back with write_result. Send If-None-Match: * to create only.
{
"error": {
"type": "invalid_request_error",
"code": "meter_name_taken",
"message": "A meter named \"Image generations\" already exists in this store",
"request_id": "req_abc123def456",
"param": "events[3].customer_id",
"details": {
"archived_holder": true,
"archived_holder_id": "mtr_abc123"
}
}
}
{
"error": {
"type": "invalid_request_error",
"code": "meter_name_taken",
"message": "A meter named \"Image generations\" already exists in this store",
"request_id": "req_abc123def456",
"param": "events[3].customer_id",
"details": {
"archived_holder": true,
"archived_holder_id": "mtr_abc123"
}
}
}
{
"error": {
"type": "invalid_request_error",
"code": "meter_name_taken",
"message": "A meter named \"Image generations\" already exists in this store",
"request_id": "req_abc123def456",
"param": "events[3].customer_id",
"details": {
"archived_holder": true,
"archived_holder_id": "mtr_abc123"
}
}
}
{
"error": {
"type": "invalid_request_error",
"code": "meter_name_taken",
"message": "A meter named \"Image generations\" already exists in this store",
"request_id": "req_abc123def456",
"param": "events[3].customer_id",
"details": {
"archived_holder": true,
"archived_holder_id": "mtr_abc123"
}
}
}
Authorizations
x-api-key
string
header
required
API key for authentication. You can find your API key in the Creem dashboard under Settings > API Keys.
Headers
Idempotency-Key
string
Deprecated: send an external_id, which makes a retry an update of the meter the first call created. Without an external_id, a retry with the same key returns the originally created meter instead of creating a duplicate; reusing a key with a different body returns the first result, and a key lasts 24 hours. After a failed create whose outcome is unclear, the key answers 429 for up to 5 minutes. With an external_id the header is ignored.
If-None-Match
string
Send * to create only: when a meter of the store already has the external_id, the call answers 412 (precondition_failed) and writes nothing. Only * is accepted on a request with an external_id (any other value answers 400); without one the header is ignored.
Query Parameters
dry_run
boolean
Send true to preview the write: the request runs as it would and is rolled back, so nothing is written and Idempotency-Key is neither read nor stored. The answer is the one the real call would give: the same status (201 for a create) and errors, and the meter with write_result.dry_runtrue. The id of a meter a dry run would create is never stored: a GET of it answers 404. false or no parameter is a real call; any other value answers 400.
Body
application/json
name
string
Human-readable meter name, unique within your store. Required when creating a meter. On an existing meter (by external_id) a different name renames it.
Example:
"Image generations"
event_name
string
The usage event name this meter consumes. Required when creating a meter. It cannot change after create: on an existing meter (by external_id) a different value is ignored and reported as a field_not_writable warning.
Example:
"image.generated"
aggregation
enum<string>
Aggregation applied to the matching events. Required when creating a meter. Part of the meter definition: on an existing meter (by external_id) a different value is accepted only while the meter is not locked.
Available options:
count,
sum,
average,
min,
max,
unique
Example:
"sum"
aggregation_property
string | null
Event property the aggregation reduces. Required for every aggregation except "count", which ignores it. On an existing meter (by external_id), omit it to leave it unchanged or send null to clear it.
Example:
"tokens"
filter
object
Optional filter narrowing which events the meter counts. Omitted means "count every event with this event name" on a create, and leaves the filter unchanged on an existing meter (by external_id), where a sent filter replaces the whole filter and null is rejected (400), as on update.
Show child attributes
unit_label
string
Display unit for the metered quantity. Also names the customer-credits bucket the meter settles into. Required when creating a meter. It cannot change after create: on an existing meter (by external_id) a different value is ignored and reported as a field_not_writable warning.
Example:
"images"
external_id
string
Your own key for this meter. Creem never sets it. Unique per store, case-sensitive; 1 to 255 characters: letters, digits, _, -, . and :. With a key the call is an upsert: it creates the meter when no meter of your store has the key, and otherwise updates the meter that has it (archived meters too, which stay archived). Send If-None-Match: * to create only.
Example:
"image-generations"
Response
Only with an external_id: a meter of the store already had the key, and it was updated (write_result.resultupdated) or already matched the request (unchanged).
id
string
required
Meter ID
Example:
"mtr_abc123"
store_id
string
required
Store ID
Example:
"sto_abc123"
name
string
required
Meter name
Example:
"Image generations"
event_name
string
required
Usage event name the meter consumes
Example:
"image.generated"
aggregation
enum<string>
required
Aggregation applied to matching events
Available options:
count,
sum,
average,
min,
max,
unique
Example:
"sum"
aggregation_property
string | null
required
Property the aggregation reduces; null for "count"
Example:
"tokens"
filter
object
required
The meter filter; always present (empty clauses = match all)
Show child attributes
unit_label
string
required
Display unit
Example:
"images"
status
enum<string>
required
Whether the meter is active or archived
Available options:
active,
archived
Example:
"active"
external_id
string | null
required
Your own key for this meter (external_id), unique per store. null when the meter has none.
Example:
"image-generations"
locked
boolean
required
Whether the meter is locked. A meter locks once it has processed usage or has an associated purchase; an update that changes a locked meter's definition is refused with 409. A lock freezes the filter and aggregation. event_name and unit_label can't be changed on any meter; name and external_id stay changeable. Aggregation runs asynchronously, so a meter can lock between a read that says false and the next update.
Example:
false
created_at
string
required
Creation timestamp (ISO 8601)
updated_at
string
required
Last update timestamp (ISO 8601)
write_result
object
required
What this write did and should tell you.
Show child attributes
{"docsConfig":{"theme":"mint","$schema":"https://mintlify.com/docs.json","name":"Creem","colors":{"primary":"#FFBE98","light":"#FFBE98","dark":"#B09CFB"},"logo":{"light":"https://mintcdn.com/creem/-AIVGXbrCJu_8i70/logo/light.svg?fit=max\u0026auto=format\u0026n=-AIVGXbrCJu_8i70\u0026q=85\u0026s=686f06f43a3d7e4c0456e22de64c8bae","dark":"https://mintcdn.com/creem/-AIVGXbrCJu_8i70/logo/dark.svg?fit=max\u0026auto=format\u0026n=-AIVGXbrCJu_8i70\u0026q=85\u0026s=7c9135ca8b2365d6ec3728dc087f694d"},"favicon":"https://mintcdn.com/creem/-AIVGXbrCJu_8i70/favicon.svg?fit=max\u0026auto=format\u0026n=-AIVGXbrCJu_8i70\u0026q=85\u0026s=92df9cacbac6c8f17dbeb2d8b6befb93","navbar":{"links":[{"href":"https://creem.io/contact","label":"Support"},{"href":"https://docs.creem.io/llms.txt","label":"llms.txt"},{"href":"https://docs.creem.io/llms-full.txt","label":"llms-full.txt"}],"primary":{"type":"button","label":"Creem","href":"https://creem.io"}},"footer":{"socials":{"x":"https://x.com/creem_io","linkedin":"https://www.linkedin.com/company/creemio"}},"seo":{"metatags":{"twitter:site":"@creem_io","og:site_name":"Creem Documentation","keywords":"merchant of record, payment api, saas billing, subscription management, global payments, MoR, affiliate program, affiliate marketing, referral program"},"indexing":"all"},"integrations":{"posthog":{"apiKey":"phc_placeholder_gabriel_will_provide","apiHost":"https://us.posthog.com"}},"contextual":{"options":["copy","view","chatgpt","claude","perplexity"],"display":"header"},"styling":{"latex":true},"navigation":{"global":{"anchors":[{"anchor":"Community","icon":"discord","href":"https://discord.gg/q3GKZs92Av"},{"anchor":"Blog","icon":"newspaper","href":"https://creem.io/blog"}]},"pages":[]}},"deployment":{"deploymentMetadataValue":{"subdomain":"creem","hasAudioNarration":false,"actualSubdomain":"creem","customDomains":["docs.creem.io"],"gitSource":{"type":"github","owner":"armitage-labs","repo":"creem","deployBranch":"main","contentDirectory":"packages/docs","isPrivate":false,"mountPath":"","label":""},"entitlements":{},"buildId":"6b0b667d7a1cd5629f3b6110","clientVersion":"0.0.4344","searchFilterCounts":[{"language":"default","tag":"Documentation","count":108},{"language":"default","tag":"API Reference","count":78},{"language":"default","tag":"Features","count":46},{"language":"default","tag":"Code","count":22},{"language":"default","tag":"Customer Credits","count":19},{"language":"default","tag":"SDKs","count":19},{"language":"default","tag":"Guides","count":18},{"language":"default","tag":"Get Started","count":12},{"language":"default","tag":"AI","count":9},{"language":"default","tag":"Meters","count":9}]},"assistantConfig":{},"basePath":"","hasChatPermissions":false,"hasWebMcpPermissions":false,"toggles":[{"name":"kill-isr","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"custom-rbac-roles","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-mintlify-slack","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-integrations-settings","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"rbac-expansion","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-pr-grouping","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"custom-prefix","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"analytics-v7","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"user-flows-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"no-publish-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving-live","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"stripTemperatureMiddleware","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"support-platform-pylon-zendesk","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"instant-rollback","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications-server","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-fable","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fixed-ai-action-pricing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"site-roles","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automation-resolve-merge-conflict","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"scoped-publishing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"mintql","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"page-level-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-version-history-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"billing-page-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"full-page-search","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workspace-projects","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fork-pr-previews","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"revalidation-jwt","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"hobby-abuse-scan","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"dashboard-inbox","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"turbopuffer-dual-write","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"approve-review-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-metadata","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"turbopuffer-serve","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"live-agents","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"starter-pricing","enabled":true,"variant":{"name":"treatment","enabled":true,"payload":{"type":"string","value":"treatment"},"feature_enabled":true},"impressionData":false},{"name":"llms-txt-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"wildcard-email-auth","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false}],"starterQuestions":[],"googleFontsInlined":false},"customCss":[{"filePath":"styles.css","content":"#topbar-cta-button{color:#000000}"}]}
{"page":{"pagePath":"api-reference/endpoint/create-meter","slug":"/api-reference/endpoint/create-meter","pageMetadata":{"title":"Create a meter","description":"Define how a stream of usage events is aggregated into billable units. The unit label doubles as the display unit and as the credit bucket the meter settles into. A duplicate name within the store is rejected with 409 meter_name_taken. With an `external_id` the call is an upsert: it creates the meter when the key is new (201) and updates the meter that holds the key otherwise (200), archived meters included, which stay archived. Only the fields you send change, each with the meaning `PATCH /v1/meters/{id}` gives it; `event_name` and `unit_label` cannot change after create, and a different value is ignored with a `field_not_writable` warning. The request is compared with the stored meter first, so a request that changes nothing answers `unchanged` and writes nothing, also on a locked meter, and retrying after a timeout is safe; only a real change of a locked meter's filter or aggregation answers 409 `meter_immutable`. The meter comes back with `write_result`. Send `If-None-Match: *` to create only.","openapi":"post /v1/meters","href":"/api-reference/endpoint/create-meter"},"description":{"compiledSource":"\"use strict\";\nconst {jsx: _jsx, jsxs: _jsxs} = arguments[0];\nconst {useMDXComponents: _provideComponents} = arguments[0];\nfunction _createMdxContent(props) {\n const _components = {\n code: \"code\",\n p: \"p\",\n ..._provideComponents(),\n ...props.components\n };\n return _jsxs(_components.p, {\n children: [\"Define how a stream of usage events is aggregated into billable units. The unit label doubles as the display unit and as the credit bucket the meter settles into. A duplicate name within the store is rejected with 409 meter_name_taken. With an \", _jsx(_components.code, {\n children: \"external_id\"\n }), \" the call is an upsert: it creates the meter when the key is new (201) and updates the meter that holds the key otherwise (200), archived meters included, which stay archived. Only the fields you send change, each with the meaning \", _jsx(_components.code, {\n children: \"PATCH /v1/meters/{id}\"\n }), \" gives it; \", _jsx(_components.code, {\n children: \"event_name\"\n }), \" and \", _jsx(_components.code, {\n children: \"unit_label\"\n }), \" cannot change after create, and a different value is ignored with a \", _jsx(_components.code, {\n children: \"field_not_writable\"\n }), \" warning. The request is compared with the stored meter first, so a request that changes nothing answers \", _jsx(_components.code, {\n children: \"unchanged\"\n }), \" and writes nothing, also on a locked meter, and retrying after a timeout is safe; only a real change of a locked meter’s filter or aggregation answers 409 \", _jsx(_components.code, {\n children: \"meter_immutable\"\n }), \". The meter comes back with \", _jsx(_components.code, {\n children: \"write_result\"\n }), \". Send \", _jsx(_components.code, {\n children: \"If-None-Match: *\"\n }), \" to create only.\"]\n });\n}\nfunction MDXContent(props = {}) {\n const {wrapper: MDXLayout} = {\n ..._provideComponents(),\n ...props.components\n };\n return MDXLayout ? _jsx(MDXLayout, {\n ...props,\n children: _jsx(_createMdxContent, {\n ...props\n })\n }) : _createMdxContent(props);\n}\nreturn {\n default: MDXContent\n};\n","frontmatter":{},"scope":{}},"pageType":"default","mdx":{"mdxSource":{"compiledSource":"\"use strict\";const{Fragment:_Fragment,jsx:_jsx}=arguments[0];const{useMDXComponents:_provideComponents}=arguments[0];function _createMdxContent(props){return _jsx(_Fragment,{})}function MDXContent(props={}){const{wrapper:MDXLayout}={..._provideComponents(),...props.components};return MDXLayout?_jsx(MDXLayout,{...props,children:_jsx(_createMdxContent,{...props})}):_createMdxContent(props)}return{default:MDXContent}","frontmatter":{},"scope":{"config":{},"pageMetadata":{"title":"Create a meter","description":"Define how a stream of usage events is aggregated into billable units. The unit label doubles as the display unit and as the credit bucket the meter settles into. A duplicate name within the store is rejected with 409 meter_name_taken. With an `external_id` the call is an upsert: it creates the meter when the key is new (201) and updates the meter that holds the key otherwise (200), archived meters included, which stay archived. Only the fields you send change, each with the meaning `PATCH /v1/meters/{id}` gives it; `event_name` and `unit_label` cannot change after create, and a different value is ignored with a `field_not_writable` warning. The request is compared with the stored meter first, so a request that changes nothing answers `unchanged` and writes nothing, also on a locked meter, and retrying after a timeout is safe; only a real change of a locked meter's filter or aggregation answers 409 `meter_immutable`. The meter comes back with `write_result`. Send `If-None-Match: *` to create only.","openapi":"post /v1/meters","href":"/api-reference/endpoint/create-meter"}}},"mdxSourceWithNoJs":null},"mdxExtracts":{"tableOfContents":[],"codeExamples":{}},"jsLinks":["/_mintlify/custom/creem/ff82c2fd59431fcd/scripts/generate-api-docs.js"],"openApiReferenceData":{"operation":{"operationId":"createMeter","x-speakeasy-name-override":"createMeter","x-speakeasy-group":"meters","summary":"Create a meter","description":"Define how a stream of usage events is aggregated into billable units. The unit label doubles as the display unit and as the credit bucket the meter settles into. A duplicate name within the store is rejected with 409 meter_name_taken. With an `external_id` the call is an upsert: it creates the meter when the key is new (201) and updates the meter that holds the key otherwise (200), archived meters included, which stay archived. Only the fields you send change, each with the meaning `PATCH /v1/meters/{id}` gives it; `event_name` and `unit_label` cannot change after create, and a different value is ignored with a `field_not_writable` warning. The request is compared with the stored meter first, so a request that changes nothing answers `unchanged` and writes nothing, also on a locked meter, and retrying after a timeout is safe; only a real change of a locked meter's filter or aggregation answers 409 `meter_immutable`. The meter comes back with `write_result`. Send `If-None-Match: *` to create only.","parameters":["e3b1e6e6-e537-4f38-adfa-ef6ca2e5881b","c3b758be-73ce-496e-8a3e-ccc16556619d","56bc847d-70e3-4bb1-abe5-ba7ed399238e"],"requestBody":"e876d700-d97c-454b-97e0-8265aa75dfa9","responses":{"200":"eb4f1eeb-d82a-4e31-b7ef-8010197339e0","201":"df535aec-d13f-45bd-887d-9bc1e07c5c90","400":"21f28e17-91b3-4a97-acb5-a5f1d89ed19e","401":"543de42d-b313-4799-a643-3a20c5429af7","404":"dfced577-102b-4bcf-8ba1-532c4872b115","409":"fb789ec3-123c-451b-8de5-6ec5700633ea","412":"5793d7d6-a19b-407f-8620-590f0696c9af","422":"e6c30b65-6b80-4396-b44a-4055b5621511","429":"6858465c-376a-4a94-8f1b-751988806727"},"tags":["Meters"],"security":["672489fd-302e-4100-b302-df8ee73f888c"],"method":"post","type":"path","servers":["31665feb-482b-4353-8ac5-f6916acb7a8f","6c07f73e-92c3-48a8-87dd-e830da7c99ad"],"path":"/v1/meters","baseUrlOptions":["https://api.creem.io","https://test-api.creem.io"],"title":"Create a meter","codeSamples":[],"requiredOnlyExamples":false,"requestExampleType":"generated","responseExampleType":"generated"},"dependencies":{"parameters":{"e3b1e6e6-e537-4f38-adfa-ef6ca2e5881b":{"name":"Idempotency-Key","required":false,"in":"header","description":"Deprecated: send an `external_id`, which makes a retry an update of the meter the first call created. Without an `external_id`, a retry with the same key returns the originally created meter instead of creating a duplicate; reusing a key with a different body returns the first result, and a key lasts 24 hours. After a failed create whose outcome is unclear, the key answers 429 for up to 5 minutes. With an `external_id` the header is ignored.","deprecated":true,"schema":{"type":"string","isRequired":false,"description":"Deprecated: send an `external_id`, which makes a retry an update of the meter the first call created. Without an `external_id`, a retry with the same key returns the originally created meter instead of creating a duplicate; reusing a key with a different body returns the first result, and a key lasts 24 hours. After a failed create whose outcome is unclear, the key answers 429 for up to 5 minutes. With an `external_id` the header is ignored.","uniqueKey":"","typeLabel":"string"}},"c3b758be-73ce-496e-8a3e-ccc16556619d":{"name":"If-None-Match","required":false,"in":"header","description":"Send `*` to create only: when a meter of the store already has the `external_id`, the call answers `412` (`precondition_failed`) and writes nothing. Only `*` is accepted on a request with an `external_id` (any other value answers `400`); without one the header is ignored.","schema":{"type":"string","isRequired":false,"description":"Send `*` to create only: when a meter of the store already has the `external_id`, the call answers `412` (`precondition_failed`) and writes nothing. Only `*` is accepted on a request with an `external_id` (any other value answers `400`); without one the header is ignored.","uniqueKey":"","typeLabel":"string"}},"56bc847d-70e3-4bb1-abe5-ba7ed399238e":{"name":"dry_run","required":false,"in":"query","description":"Send `true` to preview the write: the request runs as it would and is rolled back, so nothing is written and `Idempotency-Key` is neither read nor stored. The answer is the one the real call would give: the same status (`201` for a create) and errors, and the meter with `write_result.dry_run` `true`. The id of a meter a dry run would create is never stored: a `GET` of it answers `404`. `false` or no parameter is a real call; any other value answers `400`.","schema":{"type":"boolean","isRequired":false,"description":"Send `true` to preview the write: the request runs as it would and is rolled back, so nothing is written and `Idempotency-Key` is neither read nor stored. The answer is the one the real call would give: the same status (`201` for a create) and errors, and the meter with `write_result.dry_run` `true`. The id of a meter a dry run would create is never stored: a `GET` of it answers `404`. `false` or no parameter is a real call; any other value answers `400`.","uniqueKey":"","typeLabel":"boolean"}}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","description":"Human-readable meter name, unique within your store. Required when creating a meter. On an existing meter (by `external_id`) a different name renames it.","example":"Image generations","uniqueKey":"name","typeLabel":"string"},"event_name":{"type":"string","description":"The usage event name this meter consumes. Required when creating a meter. It cannot change after create: on an existing meter (by `external_id`) a different value is ignored and reported as a `field_not_writable` warning.","example":"image.generated","uniqueKey":"event_name","typeLabel":"string"},"aggregation":{"type":"string","description":"Aggregation applied to the matching events. Required when creating a meter. Part of the meter definition: on an existing meter (by `external_id`) a different value is accepted only while the meter is not locked.","enum":["count","sum","average","min","max","unique"],"example":"sum","uniqueKey":"aggregation","typeLabel":"enum\u003cstring>"},"aggregation_property":{"oneOf":[{"type":"string","description":"Event property the aggregation reduces. Required for every aggregation except \"count\", which ignores it. On an existing meter (by `external_id`), omit it to leave it unchanged or send `null` to clear it.","example":"tokens","uniqueKey":"aggregation_property.oneOf.0","typeLabel":"string"},{"type":"null","description":"Event property the aggregation reduces. Required for every aggregation except \"count\", which ignores it. On an existing meter (by `external_id`), omit it to leave it unchanged or send `null` to clear it.","example":"tokens","uniqueKey":"aggregation_property.oneOf.1","typeLabel":"null"}],"uniqueKey":"aggregation_property","typeLabel":"string | null"},"filter":{"type":"object","description":"Optional filter narrowing which events the meter counts. Omitted means \"count every event with this event name\" on a create, and leaves the filter unchanged on an existing meter (by `external_id`), where a sent filter replaces the whole filter and `null` is rejected (`400`), as on update.","required":["conjunction","clauses"],"properties":{"conjunction":{"type":"string","description":"How the clauses combine","enum":["and","or"],"example":"and","isRequired":true,"uniqueKey":"filter.conjunction","typeLabel":"enum\u003cstring>"},"clauses":{"description":"Filter clauses. An empty list means the meter counts every event with the given event name.","type":"array","items":{"type":"object","properties":{"property":{"type":"string","description":"Event property to test — a key of the event's `properties` bag, unprefixed.","example":"tier","isRequired":true,"uniqueKey":"filter.clauses.items.[INDEX].property","typeLabel":"string"},"operator":{"type":"string","description":"Comparison operator","enum":["equals","not_equals","gt","gte","lt","lte","contains","not_contains"],"example":"equals","isRequired":true,"uniqueKey":"filter.clauses.items.[INDEX].operator","typeLabel":"enum\u003cstring>"},"value":{"oneOf":[{"type":"string","description":"Value to compare against. Auto-parsed (number → boolean → string) on both sides before comparison, so \"10\" and 10 behave the same — which is why a raw number or boolean is accepted here as well as a string.","example":"pro","isRequired":true,"uniqueKey":"filter.clauses.items.[INDEX].value.oneOf.0","typeLabel":"string"},{"type":"number","description":"Value to compare against. Auto-parsed (number → boolean → string) on both sides before comparison, so \"10\" and 10 behave the same — which is why a raw number or boolean is accepted here as well as a string.","example":"pro","isRequired":true,"uniqueKey":"filter.clauses.items.[INDEX].value.oneOf.1","typeLabel":"number"},{"type":"boolean","description":"Value to compare against. Auto-parsed (number → boolean → string) on both sides before comparison, so \"10\" and 10 behave the same — which is why a raw number or boolean is accepted here as well as a string.","example":"pro","isRequired":true,"uniqueKey":"filter.clauses.items.[INDEX].value.oneOf.2","typeLabel":"boolean"}],"isRequired":true,"uniqueKey":"filter.clauses.items.[INDEX].value","typeLabel":"string | number | boolean"}},"required":["property","operator","value"],"uniqueKey":"filter.clauses.items.[INDEX]","typeLabel":"object"},"isRequired":true,"uniqueKey":"filter.clauses","typeLabel":"object[]"}},"uniqueKey":"filter","typeLabel":"object"},"unit_label":{"type":"string","description":"Display unit for the metered quantity. Also names the customer-credits bucket the meter settles into. Required when creating a meter. It cannot change after create: on an existing meter (by `external_id`) a different value is ignored and reported as a `field_not_writable` warning.","example":"images","uniqueKey":"unit_label","typeLabel":"string"},"external_id":{"type":"string","description":"Your own key for this meter. Creem never sets it. Unique per store, case-sensitive; 1 to 255 characters: letters, digits, `_`, `-`, `.` and `:`. With a key the call is an upsert: it creates the meter when no meter of your store has the key, and otherwise updates the meter that has it (archived meters too, which stay archived). Send `If-None-Match: *` to create only.","example":"image-generations","uniqueKey":"external_id","typeLabel":"string"}},"uniqueKey":"","typeLabel":"object"},"examples":{"Example":{"title":"Example","value":{"name":"Image generations","event_name":"image.generated","aggregation":"sum","aggregation_property":"tokens","unit_label":"images","external_id":"image-generations"}}},"exampleType":"generated"}},"exampleType":"generated"},"responses":{"eb4f1eeb-d82a-4e31-b7ef-8010197339e0":{"description":"Only with an `external_id`: a meter of the store already had the key, and it was updated (`write_result.result` `updated`) or already matched the request (`unchanged`).","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","description":"Meter ID","example":"mtr_abc123","isRequired":true,"uniqueKey":"id","typeLabel":"string"},"store_id":{"type":"string","description":"Store ID","example":"sto_abc123","isRequired":true,"uniqueKey":"store_id","typeLabel":"string"},"name":{"type":"string","description":"Meter name","example":"Image generations","isRequired":true,"uniqueKey":"name","typeLabel":"string"},"event_name":{"type":"string","description":"Usage event name the meter consumes","example":"image.generated","isRequired":true,"uniqueKey":"event_name","typeLabel":"string"},"aggregation":{"type":"string","description":"Aggregation applied to matching events","enum":["count","sum","average","min","max","unique"],"example":"sum","isRequired":true,"uniqueKey":"aggregation","typeLabel":"enum\u003cstring>"},"aggregation_property":{"oneOf":[{"type":"string","description":"Property the aggregation reduces; null for \"count\"","example":"tokens","isRequired":true,"uniqueKey":"aggregation_property.oneOf.0","typeLabel":"string"},{"type":"null","description":"Property the aggregation reduces; null for \"count\"","example":"tokens","isRequired":true,"uniqueKey":"aggregation_property.oneOf.1","typeLabel":"null"}],"isRequired":true,"uniqueKey":"aggregation_property","typeLabel":"string | null"},"filter":{"type":"object","description":"The meter filter; always present (empty clauses = match all)","required":["conjunction","clauses"],"properties":{"conjunction":{"type":"string","description":"How the clauses combine","enum":["and","or"],"example":"and","isRequired":true,"uniqueKey":"filter.conjunction","typeLabel":"enum\u003cstring>"},"clauses":{"description":"Filter clauses; empty means the meter counts every event","type":"array","items":{"type":"object","properties":{"property":{"type":"string","description":"Event property tested","example":"tier","isRequired":true,"uniqueKey":"filter.clauses.items.[INDEX].property","typeLabel":"string"},"operator":{"type":"string","description":"Comparison operator","example":"equals","isRequired":true,"uniqueKey":"filter.clauses.items.[INDEX].operator","typeLabel":"string"},"value":{"oneOf":[{"type":"string","description":"Value compared against, as stored after parsing","example":"pro","isRequired":true,"uniqueKey":"filter.clauses.items.[INDEX].value.oneOf.0","typeLabel":"string"},{"type":"number","description":"Value compared against, as stored after parsing","example":"pro","isRequired":true,"uniqueKey":"filter.clauses.items.[INDEX].value.oneOf.1","typeLabel":"number"},{"type":"boolean","description":"Value compared against, as stored after parsing","example":"pro","isRequired":true,"uniqueKey":"filter.clauses.items.[INDEX].value.oneOf.2","typeLabel":"boolean"}],"isRequired":true,"uniqueKey":"filter.clauses.items.[INDEX].value","typeLabel":"string | number | boolean"}},"required":["property","operator","value"],"uniqueKey":"filter.clauses.items.[INDEX]","typeLabel":"object"},"isRequired":true,"uniqueKey":"filter.clauses","typeLabel":"object[]"}},"isRequired":true,"uniqueKey":"filter","typeLabel":"object"},"unit_label":{"type":"string","description":"Display unit","example":"images","isRequired":true,"uniqueKey":"unit_label","typeLabel":"string"},"status":{"type":"string","description":"Whether the meter is active or archived","enum":["active","archived"],"example":"active","isRequired":true,"uniqueKey":"status","typeLabel":"enum\u003cstring>"},"external_id":{"oneOf":[{"type":"string","description":"Your own key for this meter (`external_id`), unique per store. `null` when the meter has none.","example":"image-generations","isRequired":true,"uniqueKey":"external_id.oneOf.0","typeLabel":"string"},{"type":"null","description":"Your own key for this meter (`external_id`), unique per store. `null` when the meter has none.","example":"image-generations","isRequired":true,"uniqueKey":"external_id.oneOf.1","typeLabel":"null"}],"isRequired":true,"uniqueKey":"external_id","typeLabel":"string | null"},"locked":{"type":"boolean","description":"Whether the meter is locked. A meter locks once it has processed usage or has an associated purchase; an update that changes a locked meter's definition is refused with 409. A lock freezes the filter and aggregation. `event_name` and `unit_label` can't be changed on any meter; `name` and `external_id` stay changeable. Aggregation runs asynchronously, so a meter can lock between a read that says `false` and the next update.","example":false,"isRequired":true,"uniqueKey":"locked","typeLabel":"boolean"},"created_at":{"type":"string","description":"Creation timestamp (ISO 8601)","isRequired":true,"uniqueKey":"created_at","typeLabel":"string"},"updated_at":{"type":"string","description":"Last update timestamp (ISO 8601)","isRequired":true,"uniqueKey":"updated_at","typeLabel":"string"},"write_result":{"type":"object","description":"What this write did and should tell you.","required":["result","dry_run","changes","warnings"],"properties":{"result":{"type":"string","description":"What the write did. Known values: `created`, `updated`, `unchanged` (the meter already was what the request asked for; nothing was written). More values can be added, so treat a value you do not know like `updated`.","example":"updated","isRequired":true,"uniqueKey":"write_result.result","typeLabel":"string"},"dry_run":{"type":"boolean","description":"`true` when the request was sent with `dry_run=true`: nothing was written, and the id of a meter the write would have created is never stored. `false` on a real write. Stop unless it is `true` when you meant a dry run.","example":false,"isRequired":true,"uniqueKey":"write_result.dry_run","typeLabel":"boolean"},"changes":{"description":"What changed, field by field. Empty on a create and on `unchanged`.","type":"array","items":{"type":"object","properties":{"path":{"type":"string","description":"The field that changed, by its request name: `name`, `aggregation`, `aggregation_property`, `filter`, `external_id`. `filter` is one path, because a sent filter replaces the whole filter. `status` (`active`, `archived`) appears only on a meter `POST /v1/catalog/promote` brings in line with test.","example":"name","isRequired":true,"uniqueKey":"write_result.changes.items.[INDEX].path","typeLabel":"string"},"from":{"oneOf":[{"type":"string","description":"The value before the write, as a read returns it.","example":"API calls","isRequired":true,"uniqueKey":"write_result.changes.items.[INDEX].from.oneOf.0","typeLabel":"string"},{"type":"number","description":"The value before the write, as a read returns it.","example":"API calls","isRequired":true,"uniqueKey":"write_result.changes.items.[INDEX].from.oneOf.1","typeLabel":"number"},{"type":"boolean","description":"The value before the write, as a read returns it.","example":"API calls","isRequired":true,"uniqueKey":"write_result.changes.items.[INDEX].from.oneOf.2","typeLabel":"boolean"},{"type":"array","items":{"oneOf":[{}],"uniqueKey":"write_result.changes.items.[INDEX].from.oneOf.3.items.[INDEX]","typeLabel":"any"},"description":"The value before the write, as a read returns it.","example":"API calls","isRequired":true,"uniqueKey":"write_result.changes.items.[INDEX].from.oneOf.3","typeLabel":"any[]"},{"type":"object","description":"The value before the write, as a read returns it.","example":"API calls","additionalProperties":true,"isRequired":true,"uniqueKey":"write_result.changes.items.[INDEX].from.oneOf.4","typeLabel":"object"},{"type":"null","isRequired":true,"uniqueKey":"write_result.changes.items.[INDEX].from.oneOf.5","typeLabel":"null"}],"isRequired":true,"uniqueKey":"write_result.changes.items.[INDEX].from","typeLabel":"string | number | boolean | any[] | object | null"},"to":{"oneOf":[{"type":"string","description":"The value after the write, as a read returns it.","example":"API requests","isRequired":true,"uniqueKey":"write_result.changes.items.[INDEX].to.oneOf.0","typeLabel":"string"},{"type":"number","description":"The value after the write, as a read returns it.","example":"API requests","isRequired":true,"uniqueKey":"write_result.changes.items.[INDEX].to.oneOf.1","typeLabel":"number"},{"type":"boolean","description":"The value after the write, as a read returns it.","example":"API requests","isRequired":true,"uniqueKey":"write_result.changes.items.[INDEX].to.oneOf.2","typeLabel":"boolean"},{"type":"array","items":{"oneOf":[{}],"uniqueKey":"write_result.changes.items.[INDEX].to.oneOf.3.items.[INDEX]","typeLabel":"any"},"description":"The value after the write, as a read returns it.","example":"API requests","isRequired":true,"uniqueKey":"write_result.changes.items.[INDEX].to.oneOf.3","typeLabel":"any[]"},{"type":"object","description":"The value after the write, as a read returns it.","example":"API requests","additionalProperties":true,"isRequired":true,"uniqueKey":"write_result.changes.items.[INDEX].to.oneOf.4","typeLabel":"object"},{"type":"null","isRequired":true,"uniqueKey":"write_result.changes.items.[INDEX].to.oneOf.5","typeLabel":"null"}],"isRequired":true,"uniqueKey":"write_result.changes.items.[INDEX].to","typeLabel":"string | number | boolean | any[] | object | null"}},"required":["path","from","to"],"uniqueKey":"write_result.changes.items.[INDEX]","typeLabel":"object"},"isRequired":true,"uniqueKey":"write_result.changes","typeLabel":"object[]"},"warnings":{"description":"Things to know about this write. The write went through. Empty when there is nothing to report.","type":"array","items":{"type":"object","properties":{"code":{"type":"string","description":"What the warning is about. Known values: `field_not_writable` (the field in `path`, `event_name` or `unit_label`, cannot change after create; the value sent was ignored and the meter keeps its own). More values can be added, so ignore a code you do not know.","example":"field_not_writable","isRequired":true,"uniqueKey":"write_result.warnings.items.[INDEX].code","typeLabel":"string"},"path":{"type":"string","description":"The field the warning is about.","example":"unit_label","isRequired":true,"uniqueKey":"write_result.warnings.items.[INDEX].path","typeLabel":"string"}},"required":["code","path"],"uniqueKey":"write_result.warnings.items.[INDEX]","typeLabel":"object"},"isRequired":true,"uniqueKey":"write_result.warnings","typeLabel":"object[]"}},"isRequired":true,"uniqueKey":"write_result","typeLabel":"object"}},"required":["id","store_id","name","event_name","aggregation","aggregation_property","filter","unit_label","status","external_id","locked","created_at","updated_at","write_result"],"uniqueKey":"","typeLabel":"object"},"examples":{"Example":{"title":"Example","value":{"id":"mtr_abc123","store_id":"sto_abc123","name":"Image generations","event_name":"image.generated","aggregation":"sum","aggregation_property":"tokens","filter":{"conjunction":"and","clauses":[{"property":"tier","operator":"equals","value":"pro"}]},"unit_label":"images","status":"active","external_id":"image-generations","locked":false,"created_at":"\u003cstring>","updated_at":"\u003cstring>","write_result":{"result":"updated","dry_run":false,"changes":[{"path":"name","from":"API calls","to":"API requests"}],"warnings":[{"code":"field_not_writable","path":"unit_label"}]}}}},"exampleType":"generated"}},"exampleType":"generated"},"df535aec-d13f-45bd-887d-9bc1e07c5c90":{"description":"Meter created (also by a dry run, which stores nothing)","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","description":"Meter ID","example":"mtr_abc123","isRequired":true,"uniqueKey":"id","typeLabel":"string"},"store_id":{"type":"string","description":"Store ID","example":"sto_abc123","isRequired":true,"uniqueKey":"store_id","typeLabel":"string"},"name":{"type":"string","description":"Meter name","example":"Image generations","isRequired":true,"uniqueKey":"name","typeLabel":"string"},"event_name":{"type":"string","description":"Usage event name the meter consumes","example":"image.generated","isRequired":true,"uniqueKey":"event_name","typeLabel":"string"},"aggregation":{"type":"string","description":"Aggregation applied to matching events","enum":["count","sum","average","min","max","unique"],"example":"sum","isRequired":true,"uniqueKey":"aggregation","typeLabel":"enum\u003cstring>"},"aggregation_property":{"oneOf":[{"type":"string","description":"Property the aggregation reduces; null for \"count\"","example":"tokens","isRequired":true,"uniqueKey":"aggregation_property.oneOf.0","typeLabel":"string"},{"type":"null","description":"Property the aggregation reduces; null for \"count\"","example":"tokens","isRequired":true,"uniqueKey":"aggregation_property.oneOf.1","typeLabel":"null"}],"isRequired":true,"uniqueKey":"aggregation_property","typeLabel":"string | null"},"filter":{"type":"object","description":"The meter filter; always present (empty clauses = match all)","required":["conjunction","clauses"],"properties":{"conjunction":{"type":"string","description":"How the clauses combine","enum":["and","or"],"example":"and","isRequired":true,"uniqueKey":"filter.conjunction","typeLabel":"enum\u003cstring>"},"clauses":{"description":"Filter clauses; empty means the meter counts every event","type":"array","items":{"type":"object","properties":{"property":{"type":"string","description":"Event property tested","example":"tier","isRequired":true,"uniqueKey":"filter.clauses.items.[INDEX].property","typeLabel":"string"},"operator":{"type":"string","description":"Comparison operator","example":"equals","isRequired":true,"uniqueKey":"filter.clauses.items.[INDEX].operator","typeLabel":"string"},"value":{"oneOf":[{"type":"string","description":"Value compared against, as stored after parsing","example":"pro","isRequired":true,"uniqueKey":"filter.clauses.items.[INDEX].value.oneOf.0","typeLabel":"string"},{"type":"number","description":"Value compared against, as stored after parsing","example":"pro","isRequired":true,"uniqueKey":"filter.clauses.items.[INDEX].value.oneOf.1","typeLabel":"number"},{"type":"boolean","description":"Value compared against, as stored after parsing","example":"pro","isRequired":true,"uniqueKey":"filter.clauses.items.[INDEX].value.oneOf.2","typeLabel":"boolean"}],"isRequired":true,"uniqueKey":"filter.clauses.items.[INDEX].value","typeLabel":"string | number | boolean"}},"required":["property","operator","value"],"uniqueKey":"filter.clauses.items.[INDEX]","typeLabel":"object"},"isRequired":true,"uniqueKey":"filter.clauses","typeLabel":"object[]"}},"isRequired":true,"uniqueKey":"filter","typeLabel":"object"},"unit_label":{"type":"string","description":"Display unit","example":"images","isRequired":true,"uniqueKey":"unit_label","typeLabel":"string"},"status":{"type":"string","description":"Whether the meter is active or archived","enum":["active","archived"],"example":"active","isRequired":true,"uniqueKey":"status","typeLabel":"enum\u003cstring>"},"external_id":{"oneOf":[{"type":"string","description":"Your own key for this meter (`external_id`), unique per store. `null` when the meter has none.","example":"image-generations","isRequired":true,"uniqueKey":"external_id.oneOf.0","typeLabel":"string"},{"type":"null","description":"Your own key for this meter (`external_id`), unique per store. `null` when the meter has none.","example":"image-generations","isRequired":true,"uniqueKey":"external_id.oneOf.1","typeLabel":"null"}],"isRequired":true,"uniqueKey":"external_id","typeLabel":"string | null"},"locked":{"type":"boolean","description":"Whether the meter is locked. A meter locks once it has processed usage or has an associated purchase; an update that changes a locked meter's definition is refused with 409. A lock freezes the filter and aggregation. `event_name` and `unit_label` can't be changed on any meter; `name` and `external_id` stay changeable. Aggregation runs asynchronously, so a meter can lock between a read that says `false` and the next update.","example":false,"isRequired":true,"uniqueKey":"locked","typeLabel":"boolean"},"created_at":{"type":"string","description":"Creation timestamp (ISO 8601)","isRequired":true,"uniqueKey":"created_at","typeLabel":"string"},"updated_at":{"type":"string","description":"Last update timestamp (ISO 8601)","isRequired":true,"uniqueKey":"updated_at","typeLabel":"string"},"write_result":{"type":"object","description":"What this write did and should tell you.","required":["result","dry_run","changes","warnings"],"properties":{"result":{"type":"string","description":"What the write did. Known values: `created`, `updated`, `unchanged` (the meter already was what the request asked for; nothing was written). More values can be added, so treat a value you do not know like `updated`.","example":"updated","isRequired":true,"uniqueKey":"write_result.result","typeLabel":"string"},"dry_run":{"type":"boolean","description":"`true` when the request was sent with `dry_run=true`: nothing was written, and the id of a meter the write would have created is never stored. `false` on a real write. Stop unless it is `true` when you meant a dry run.","example":false,"isRequired":true,"uniqueKey":"write_result.dry_run","typeLabel":"boolean"},"changes":{"description":"What changed, field by field. Empty on a create and on `unchanged`.","type":"array","items":{"type":"object","properties":{"path":{"type":"string","description":"The field that changed, by its request name: `name`, `aggregation`, `aggregation_property`, `filter`, `external_id`. `filter` is one path, because a sent filter replaces the whole filter. `status` (`active`, `archived`) appears only on a meter `POST /v1/catalog/promote` brings in line with test.","example":"name","isRequired":true,"uniqueKey":"write_result.changes.items.[INDEX].path","typeLabel":"string"},"from":{"oneOf":[{"type":"string","description":"The value before the write, as a read returns it.","example":"API calls","isRequired":true,"uniqueKey":"write_result.changes.items.[INDEX].from.oneOf.0","typeLabel":"string"},{"type":"number","description":"The value before the write, as a read returns it.","example":"API calls","isRequired":true,"uniqueKey":"write_result.changes.items.[INDEX].from.oneOf.1","typeLabel":"number"},{"type":"boolean","description":"The value before the write, as a read returns it.","example":"API calls","isRequired":true,"uniqueKey":"write_result.changes.items.[INDEX].from.oneOf.2","typeLabel":"boolean"},{"type":"array","items":{"oneOf":[{}],"uniqueKey":"write_result.changes.items.[INDEX].from.oneOf.3.items.[INDEX]","typeLabel":"any"},"description":"The value before the write, as a read returns it.","example":"API calls","isRequired":true,"uniqueKey":"write_result.changes.items.[INDEX].from.oneOf.3","typeLabel":"any[]"},{"type":"object","description":"The value before the write, as a read returns it.","example":"API calls","additionalProperties":true,"isRequired":true,"uniqueKey":"write_result.changes.items.[INDEX].from.oneOf.4","typeLabel":"object"},{"type":"null","isRequired":true,"uniqueKey":"write_result.changes.items.[INDEX].from.oneOf.5","typeLabel":"null"}],"isRequired":true,"uniqueKey":"write_result.changes.items.[INDEX].from","typeLabel":"string | number | boolean | any[] | object | null"},"to":{"oneOf":[{"type":"string","description":"The value after the write, as a read returns it.","example":"API requests","isRequired":true,"uniqueKey":"write_result.changes.items.[INDEX].to.oneOf.0","typeLabel":"string"},{"type":"number","description":"The value after the write, as a read returns it.","example":"API requests","isRequired":true,"uniqueKey":"write_result.changes.items.[INDEX].to.oneOf.1","typeLabel":"number"},{"type":"boolean","description":"The value after the write, as a read returns it.","example":"API requests","isRequired":true,"uniqueKey":"write_result.changes.items.[INDEX].to.oneOf.2","typeLabel":"boolean"},{"type":"array","items":{"oneOf":[{}],"uniqueKey":"write_result.changes.items.[INDEX].to.oneOf.3.items.[INDEX]","typeLabel":"any"},"description":"The value after the write, as a read returns it.","example":"API requests","isRequired":true,"uniqueKey":"write_result.changes.items.[INDEX].to.oneOf.3","typeLabel":"any[]"},{"type":"object","description":"The value after the write, as a read returns it.","example":"API requests","additionalProperties":true,"isRequired":true,"uniqueKey":"write_result.changes.items.[INDEX].to.oneOf.4","typeLabel":"object"},{"type":"null","isRequired":true,"uniqueKey":"write_result.changes.items.[INDEX].to.oneOf.5","typeLabel":"null"}],"isRequired":true,"uniqueKey":"write_result.changes.items.[INDEX].to","typeLabel":"string | number | boolean | any[] | object | null"}},"required":["path","from","to"],"uniqueKey":"write_result.changes.items.[INDEX]","typeLabel":"object"},"isRequired":true,"uniqueKey":"write_result.changes","typeLabel":"object[]"},"warnings":{"description":"Things to know about this write. The write went through. Empty when there is nothing to report.","type":"array","items":{"type":"object","properties":{"code":{"type":"string","description":"What the warning is about. Known values: `field_not_writable` (the field in `path`, `event_name` or `unit_label`, cannot change after create; the value sent was ignored and the meter keeps its own). More values can be added, so ignore a code you do not know.","example":"field_not_writable","isRequired":true,"uniqueKey":"write_result.warnings.items.[INDEX].code","typeLabel":"string"},"path":{"type":"string","description":"The field the warning is about.","example":"unit_label","isRequired":true,"uniqueKey":"write_result.warnings.items.[INDEX].path","typeLabel":"string"}},"required":["code","path"],"uniqueKey":"write_result.warnings.items.[INDEX]","typeLabel":"object"},"isRequired":true,"uniqueKey":"write_result.warnings","typeLabel":"object[]"}},"isRequired":true,"uniqueKey":"write_result","typeLabel":"object"}},"required":["id","store_id","name","event_name","aggregation","aggregation_property","filter","unit_label","status","external_id","locked","created_at","updated_at","write_result"],"uniqueKey":"","typeLabel":"object"},"examples":{"Example":{"title":"Example","value":{"id":"mtr_abc123","store_id":"sto_abc123","name":"Image generations","event_name":"image.generated","aggregation":"sum","aggregation_property":"tokens","filter":{"conjunction":"and","clauses":[{"property":"tier","operator":"equals","value":"pro"}]},"unit_label":"images","status":"active","external_id":"image-generations","locked":false,"created_at":"\u003cstring>","updated_at":"\u003cstring>","write_result":{"result":"updated","dry_run":false,"changes":[{"path":"name","from":"API calls","to":"API requests"}],"warnings":[{"code":"field_not_writable","path":"unit_label"}]}}}},"exampleType":"generated"}},"exampleType":"generated"},"21f28e17-91b3-4a97-acb5-a5f1d89ed19e":{"description":"Bad Request - Invalid input parameters","content":{"_mintlify/placeholder":{"schema":{"type":"object","description":""}}}},"543de42d-b313-4799-a643-3a20c5429af7":{"description":"Unauthorized - Invalid or missing API key","content":{"_mintlify/placeholder":{"schema":{"type":"object","description":""}}}},"dfced577-102b-4bcf-8ba1-532c4872b115":{"description":"Not Found - Resource does not exist","content":{"_mintlify/placeholder":{"schema":{"type":"object","description":""}}}},"fb789ec3-123c-451b-8de5-6ec5700633ea":{"description":"A meter with this name already exists in the store, or another meter of the store already uses this `external_id` (code `external_id_taken`), or, with an `external_id` that names a locked meter, the request changes its filter or aggregation (code `meter_immutable`). Nothing is changed.","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","description":"Error details","required":["type","code","message","request_id"],"properties":{"type":{"type":"string","description":"Error category","enum":["invalid_request_error","api_error","authentication_error","rate_limit_error"],"example":"invalid_request_error","isRequired":true,"uniqueKey":"error.type","typeLabel":"enum\u003cstring>"},"code":{"oneOf":[{"type":"string","description":"Machine-readable error code","example":"meter_name_taken","isRequired":true,"uniqueKey":"error.code.oneOf.0","typeLabel":"string"},{"type":"null","description":"Machine-readable error code","example":"meter_name_taken","isRequired":true,"uniqueKey":"error.code.oneOf.1","typeLabel":"null"}],"isRequired":true,"uniqueKey":"error.code","typeLabel":"string | null"},"message":{"type":"string","description":"Human-readable error message","example":"A meter named \"Image generations\" already exists in this store","isRequired":true,"uniqueKey":"error.message","typeLabel":"string"},"request_id":{"type":"string","description":"Unique request identifier for support","example":"req_abc123def456","isRequired":true,"uniqueKey":"error.request_id","typeLabel":"string"},"param":{"oneOf":[{"type":"string","description":"The parameter related to the error, if applicable","example":"events[3].customer_id","uniqueKey":"error.param.oneOf.0","typeLabel":"string"},{"type":"null","description":"The parameter related to the error, if applicable","example":"events[3].customer_id","uniqueKey":"error.param.oneOf.1","typeLabel":"null"}],"uniqueKey":"error.param","typeLabel":"string | null"},"details":{"type":"object","description":"Structured, machine-readable context for errors that support an action, omitted entirely when there is none. Currently emitted for `meter_name_taken` when the colliding name is held by an ARCHIVED meter: `archived_holder` is true and `archived_holder_id` is that meter, which can be restored via POST /v1/meters/{id}/unarchive. Additive — treat unknown keys as ignorable.","example":{"archived_holder":true,"archived_holder_id":"mtr_abc123"},"additionalProperties":true,"uniqueKey":"error.details","typeLabel":"object"}},"isRequired":true,"uniqueKey":"error","typeLabel":"object"}},"required":["error"],"uniqueKey":"","typeLabel":"object"},"examples":{"Example":{"title":"Example","value":{"error":{"type":"invalid_request_error","code":"meter_name_taken","message":"A meter named \"Image generations\" already exists in this store","request_id":"req_abc123def456","param":"events[3].customer_id","details":{"archived_holder":true,"archived_holder_id":"mtr_abc123"}}}}},"exampleType":"generated"}},"exampleType":"generated"},"5793d7d6-a19b-407f-8620-590f0696c9af":{"description":"Precondition failed (code `precondition_failed`): `If-None-Match: *` was sent and a meter of the store already has this `external_id`, archived or not. `details.meter_id` names it. Nothing is written.","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","description":"Error details","required":["type","code","message","request_id"],"properties":{"type":{"type":"string","description":"Error category","enum":["invalid_request_error","api_error","authentication_error","rate_limit_error"],"example":"invalid_request_error","isRequired":true,"uniqueKey":"error.type","typeLabel":"enum\u003cstring>"},"code":{"oneOf":[{"type":"string","description":"Machine-readable error code","example":"meter_name_taken","isRequired":true,"uniqueKey":"error.code.oneOf.0","typeLabel":"string"},{"type":"null","description":"Machine-readable error code","example":"meter_name_taken","isRequired":true,"uniqueKey":"error.code.oneOf.1","typeLabel":"null"}],"isRequired":true,"uniqueKey":"error.code","typeLabel":"string | null"},"message":{"type":"string","description":"Human-readable error message","example":"A meter named \"Image generations\" already exists in this store","isRequired":true,"uniqueKey":"error.message","typeLabel":"string"},"request_id":{"type":"string","description":"Unique request identifier for support","example":"req_abc123def456","isRequired":true,"uniqueKey":"error.request_id","typeLabel":"string"},"param":{"oneOf":[{"type":"string","description":"The parameter related to the error, if applicable","example":"events[3].customer_id","uniqueKey":"error.param.oneOf.0","typeLabel":"string"},{"type":"null","description":"The parameter related to the error, if applicable","example":"events[3].customer_id","uniqueKey":"error.param.oneOf.1","typeLabel":"null"}],"uniqueKey":"error.param","typeLabel":"string | null"},"details":{"type":"object","description":"Structured, machine-readable context for errors that support an action, omitted entirely when there is none. Currently emitted for `meter_name_taken` when the colliding name is held by an ARCHIVED meter: `archived_holder` is true and `archived_holder_id` is that meter, which can be restored via POST /v1/meters/{id}/unarchive. Additive — treat unknown keys as ignorable.","example":{"archived_holder":true,"archived_holder_id":"mtr_abc123"},"additionalProperties":true,"uniqueKey":"error.details","typeLabel":"object"}},"isRequired":true,"uniqueKey":"error","typeLabel":"object"}},"required":["error"],"uniqueKey":"","typeLabel":"object"},"examples":{"Example":{"title":"Example","value":{"error":{"type":"invalid_request_error","code":"meter_name_taken","message":"A meter named \"Image generations\" already exists in this store","request_id":"req_abc123def456","param":"events[3].customer_id","details":{"archived_holder":true,"archived_holder_id":"mtr_abc123"}}}}},"exampleType":"generated"}},"exampleType":"generated"},"e6c30b65-6b80-4396-b44a-4055b5621511":{"description":"The meter definition is not satisfiable, or the unit label names a bucket reserved for AI generation credits (`generation` or `generation:*`, any casing; code `generation_bucket_reserved`)","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","description":"Error details","required":["type","code","message","request_id"],"properties":{"type":{"type":"string","description":"Error category","enum":["invalid_request_error","api_error","authentication_error","rate_limit_error"],"example":"invalid_request_error","isRequired":true,"uniqueKey":"error.type","typeLabel":"enum\u003cstring>"},"code":{"oneOf":[{"type":"string","description":"Machine-readable error code","example":"meter_name_taken","isRequired":true,"uniqueKey":"error.code.oneOf.0","typeLabel":"string"},{"type":"null","description":"Machine-readable error code","example":"meter_name_taken","isRequired":true,"uniqueKey":"error.code.oneOf.1","typeLabel":"null"}],"isRequired":true,"uniqueKey":"error.code","typeLabel":"string | null"},"message":{"type":"string","description":"Human-readable error message","example":"A meter named \"Image generations\" already exists in this store","isRequired":true,"uniqueKey":"error.message","typeLabel":"string"},"request_id":{"type":"string","description":"Unique request identifier for support","example":"req_abc123def456","isRequired":true,"uniqueKey":"error.request_id","typeLabel":"string"},"param":{"oneOf":[{"type":"string","description":"The parameter related to the error, if applicable","example":"events[3].customer_id","uniqueKey":"error.param.oneOf.0","typeLabel":"string"},{"type":"null","description":"The parameter related to the error, if applicable","example":"events[3].customer_id","uniqueKey":"error.param.oneOf.1","typeLabel":"null"}],"uniqueKey":"error.param","typeLabel":"string | null"},"details":{"type":"object","description":"Structured, machine-readable context for errors that support an action, omitted entirely when there is none. Currently emitted for `meter_name_taken` when the colliding name is held by an ARCHIVED meter: `archived_holder` is true and `archived_holder_id` is that meter, which can be restored via POST /v1/meters/{id}/unarchive. Additive — treat unknown keys as ignorable.","example":{"archived_holder":true,"archived_holder_id":"mtr_abc123"},"additionalProperties":true,"uniqueKey":"error.details","typeLabel":"object"}},"isRequired":true,"uniqueKey":"error","typeLabel":"object"}},"required":["error"],"uniqueKey":"","typeLabel":"object"},"examples":{"Example":{"title":"Example","value":{"error":{"type":"invalid_request_error","code":"meter_name_taken","message":"A meter named \"Image generations\" already exists in this store","request_id":"req_abc123def456","param":"events[3].customer_id","details":{"archived_holder":true,"archived_holder_id":"mtr_abc123"}}}}},"exampleType":"generated"}},"exampleType":"generated"},"6858465c-376a-4a94-8f1b-751988806727":{"description":"A create with this `Idempotency-Key` is in progress, or failed with an unclear outcome less than 5 minutes ago. Retry later.","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","description":"Error details","required":["type","code","message","request_id"],"properties":{"type":{"type":"string","description":"Error category","enum":["invalid_request_error","api_error","authentication_error","rate_limit_error"],"example":"invalid_request_error","isRequired":true,"uniqueKey":"error.type","typeLabel":"enum\u003cstring>"},"code":{"oneOf":[{"type":"string","description":"Machine-readable error code","example":"meter_name_taken","isRequired":true,"uniqueKey":"error.code.oneOf.0","typeLabel":"string"},{"type":"null","description":"Machine-readable error code","example":"meter_name_taken","isRequired":true,"uniqueKey":"error.code.oneOf.1","typeLabel":"null"}],"isRequired":true,"uniqueKey":"error.code","typeLabel":"string | null"},"message":{"type":"string","description":"Human-readable error message","example":"A meter named \"Image generations\" already exists in this store","isRequired":true,"uniqueKey":"error.message","typeLabel":"string"},"request_id":{"type":"string","description":"Unique request identifier for support","example":"req_abc123def456","isRequired":true,"uniqueKey":"error.request_id","typeLabel":"string"},"param":{"oneOf":[{"type":"string","description":"The parameter related to the error, if applicable","example":"events[3].customer_id","uniqueKey":"error.param.oneOf.0","typeLabel":"string"},{"type":"null","description":"The parameter related to the error, if applicable","example":"events[3].customer_id","uniqueKey":"error.param.oneOf.1","typeLabel":"null"}],"uniqueKey":"error.param","typeLabel":"string | null"},"details":{"type":"object","description":"Structured, machine-readable context for errors that support an action, omitted entirely when there is none. Currently emitted for `meter_name_taken` when the colliding name is held by an ARCHIVED meter: `archived_holder` is true and `archived_holder_id` is that meter, which can be restored via POST /v1/meters/{id}/unarchive. Additive — treat unknown keys as ignorable.","example":{"archived_holder":true,"archived_holder_id":"mtr_abc123"},"additionalProperties":true,"uniqueKey":"error.details","typeLabel":"object"}},"isRequired":true,"uniqueKey":"error","typeLabel":"object"}},"required":["error"],"uniqueKey":"","typeLabel":"object"},"examples":{"Example":{"title":"Example","value":{"error":{"type":"invalid_request_error","code":"meter_name_taken","message":"A meter named \"Image generations\" already exists in this store","request_id":"req_abc123def456","param":"events[3].customer_id","details":{"archived_holder":true,"archived_holder_id":"mtr_abc123"}}}}},"exampleType":"generated"}},"exampleType":"generated"}},"security":{"672489fd-302e-4100-b302-df8ee73f888c":{"ApiKey":{"type":"apiKey","in":"header","name":"x-api-key","description":"API key for authentication. You can find your API key in the Creem dashboard under Settings > API Keys.","scopes":[],"schemeName":"ApiKey"}}},"servers":{"31665feb-482b-4353-8ac5-f6916acb7a8f":{"url":"https://api.creem.io","description":"Production — live API for processing real transactions and data.","x-speakeasy-server-id":"prod"},"6c07f73e-92c3-48a8-87dd-e830da7c99ad":{"url":"https://test-api.creem.io","description":"Test — sandbox API for development and testing with no real charges.","x-speakeasy-server-id":"test"}},"processedSecurityOptions":[{"schemes":[{"scheme":{"type":"apiKey","in":"header","name":"x-api-key","description":"API key for authentication. You can find your API key in the Creem dashboard under Settings > API Keys.","scopes":[],"schemeName":"ApiKey"},"schema":{"title":"x-api-key","type":"string","description":"API key for authentication. You can find your API key in the Creem dashboard under Settings > API Keys.","isRequired":true,"typeLabel":"string","deprecated":false},"schemeName":"ApiKey","name":"x-api-key"}],"title":"ApiKey"}]},"originalFileLocation":"api-reference/openapi.json"},"subdomain":"creem","siteName":"Creem","title":"Create a meter - Creem","contextualStarterQuestions":[],"navMaps":{"firstHrefInVersion":{},"firstHrefInLanguage":{}},"lastModified":"2026-11-26T18:21:07.748Z","originalFileLocation":"api-reference/endpoint/create-meter.mdx"},"headHtml":"\u003cscript data-mint-head>(function(){var d=document.documentElement,p=null;if(!p){try{p=localStorage.getItem(\"isDarkMode\")}catch(e){}if(p==='true')p='dark';else if(p==='false')p='light';if(p!=='light'\u0026\u0026p!=='dark'\u0026\u0026p!=='system')p=\"system\"}var r=p==='system'?(matchMedia(\"(prefers-color-scheme: dark)\").matches?'dark':'light'):p;d.classList.remove(r==='dark'?'light':'dark');d.classList.add(r);d.setAttribute(\"data-theme-preference\",p)})();\u003c/script>\u003cmeta data-mint-head name=\"description\" content=\"Define how a stream of usage events is aggregated into billable units. The unit label doubles as the display unit and as the credit bucket the meter settles into. A duplicate name within the store is rejected with 409 meter_name_taken. With an external_id the call is an upsert: it creates the meter when the key is new (201) and updates the meter that holds the key otherwise (200), archived meters included, which stay archived. Only the fields you send change, each with the meaning PATCH /v1/meters/{id} gives it; event_name and unit_label cannot change after create, and a different value is ignored with a field_not_writable warning. The request is compared with the stored meter first, so a request that changes nothing answers unchanged and writes nothing, also on a locked meter, and retrying after a timeout is safe; only a real change of a locked meter\u0026#x27;s filter or aggregation answers 409 meter_immutable. The meter comes back with write_result. Send If-None-Match: * to create only.\">\u003cmeta data-mint-head name=\"keywords\" content=\"merchant of record, payment api, saas billing, subscription management, global payments, MoR, affiliate program, affiliate marketing, referral program\">\u003cmeta data-mint-head name=\"application-name\" content=\"Creem\">\u003cmeta data-mint-head name=\"generator\" content=\"Mintlify\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/creem/nizlPYWnvgrMkN5E/_generated/favicon/android-chrome-192x192.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"apple-touch-icon\" type=\"image/png\" sizes=\"180x180\" href=\"/mintlify-assets/_mintlify/favicons/creem/nizlPYWnvgrMkN5E/_generated/favicon/apple-touch-icon.png\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/creem/nizlPYWnvgrMkN5E/_generated/favicon/favicon-16x16.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/creem/nizlPYWnvgrMkN5E/_generated/favicon/favicon-32x32.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/creem/nizlPYWnvgrMkN5E/_generated/favicon/favicon.ico\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/creem/nizlPYWnvgrMkN5E/_generated/favicon-dark/android-chrome-192x192.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/creem/nizlPYWnvgrMkN5E/_generated/favicon-dark/favicon-16x16.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/creem/nizlPYWnvgrMkN5E/_generated/favicon-dark/favicon-32x32.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/creem/nizlPYWnvgrMkN5E/_generated/favicon-dark/favicon.ico\" media=\"(prefers-color-scheme: dark)\">\u003cmeta data-mint-head property=\"og:title\" content=\"Create a meter - Creem\">\u003cmeta data-mint-head property=\"og:description\" content=\"Define how a stream of usage events is aggregated into billable units. The unit label doubles as the display unit and as the credit bucket the meter settles into. A duplicate name within the store is rejected with 409 meter_name_taken. With an external_id the call is an upsert: it creates the meter when the key is new (201) and updates the meter that holds the key otherwise (200), archived meters included, which stay archived. Only the fields you send change, each with the meaning PATCH /v1/meters/{id} gives it; event_name and unit_label cannot change after create, and a different value is ignored with a field_not_writable warning. The request is compared with the stored meter first, so a request that changes nothing answers unchanged and writes nothing, also on a locked meter, and retrying after a timeout is safe; only a real change of a locked meter\u0026#x27;s filter or aggregation answers 409 meter_immutable. The meter comes back with write_result. Send If-None-Match: * to create only.\">\u003cmeta data-mint-head property=\"og:site_name\" content=\"Creem Documentation\">\u003cmeta data-mint-head property=\"og:url\" content=\"https://docs.creem.io/api-reference/endpoint/create-meter\">\u003cmeta data-mint-head property=\"og:type\" content=\"website\">\u003cmeta data-mint-head property=\"og:image\" content=\"https://creem.mintlify.site/_mintlify/api/og/v2?division=Meters\u0026amp;title=Create+a+meter\u0026amp;description=Define+how+a+stream+of+usage+events+is+aggregated+into+billable+units.+The+unit+label+doubles+as+the+display+unit+and+as+the+credit+bucket+the+meter+settles+int\u0026amp;theme=19d74014ebb4a0780d75c372\u0026amp;signature=36eca2f526fc84815aad5097963d4582e2a8657428f941024574137a27908538\">\u003cmeta data-mint-head property=\"og:image:width\" content=\"1200\">\u003cmeta data-mint-head property=\"og:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"twitter:card\" content=\"summary_large_image\">\u003cmeta data-mint-head name=\"twitter:title\" content=\"Create a meter - Creem\">\u003cmeta data-mint-head name=\"twitter:description\" content=\"Define how a stream of usage events is aggregated into billable units. The unit label doubles as the display unit and as the credit bucket the meter settles into. A duplicate name within the store is rejected with 409 meter_name_taken. With an external_id the call is an upsert: it creates the meter when the key is new (201) and updates the meter that holds the key otherwise (200), archived meters included, which stay archived. Only the fields you send change, each with the meaning PATCH /v1/meters/{id} gives it; event_name and unit_label cannot change after create, and a different value is ignored with a field_not_writable warning. The request is compared with the stored meter first, so a request that changes nothing answers unchanged and writes nothing, also on a locked meter, and retrying after a timeout is safe; only a real change of a locked meter\u0026#x27;s filter or aggregation answers 409 meter_immutable. The meter comes back with write_result. Send If-None-Match: * to create only.\">\u003cmeta data-mint-head name=\"twitter:image\" content=\"https://creem.mintlify.site/_mintlify/api/og/v2?division=Meters\u0026amp;title=Create+a+meter\u0026amp;description=Define+how+a+stream+of+usage+events+is+aggregated+into+billable+units.+The+unit+label+doubles+as+the+display+unit+and+as+the+credit+bucket+the+meter+settles+int\u0026amp;theme=19d74014ebb4a0780d75c372\u0026amp;signature=36eca2f526fc84815aad5097963d4582e2a8657428f941024574137a27908538\">\u003cmeta data-mint-head name=\"twitter:image:width\" content=\"1200\">\u003cmeta data-mint-head name=\"twitter:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"msapplication-config\" content=\"/mintlify-assets/_mintlify/favicons/creem/nizlPYWnvgrMkN5E/_generated/favicon/browserconfig.xml\">\u003cmeta data-mint-head name=\"apple-mobile-web-app-title\" content=\"Creem\">\u003cmeta data-mint-head name=\"msapplication-TileColor\" content=\"#FFBE98\">\u003clink data-mint-head rel=\"canonical\" href=\"https://docs.creem.io/api-reference/endpoint/create-meter\">\u003clink data-mint-head rel=\"alternate\" type=\"application/xml\" href=\"/sitemap.xml\">\u003clink data-mint-head rel=\"alternate\" type=\"text/markdown\" href=\"/api-reference/endpoint/create-meter.md\">\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@graph\":[{\"@type\":\"Organization\",\"@id\":\"https://docs.creem.io/#organization\",\"name\":\"Creem\",\"url\":\"https://docs.creem.io\",\"logo\":{\"@type\":\"ImageObject\",\"url\":\"https://mintcdn.com/creem/-AIVGXbrCJu_8i70/logo/light.svg?fit=max\u0026auto=format\u0026n=-AIVGXbrCJu_8i70\u0026q=85\u0026s=686f06f43a3d7e4c0456e22de64c8bae\"}},{\"@type\":\"WebSite\",\"@id\":\"https://docs.creem.io#website\",\"name\":\"Creem\",\"url\":\"https://docs.creem.io\",\"publisher\":{\"@id\":\"https://docs.creem.io/#organization\"}},{\"@type\":\"WebPage\",\"@id\":\"https://docs.creem.io/api-reference/endpoint/create-meter#webpage\",\"url\":\"https://docs.creem.io/api-reference/endpoint/create-meter\",\"name\":\"Create a meter\",\"description\":\"Define how a stream of usage events is aggregated into billable units. The unit label doubles as the display unit and as the credit bucket the meter settles into. A duplicate name within the store is rejected with 409 meter_name_taken. With an external_id the call is an upsert: it creates the meter when the key is new (201) and updates the meter that holds the key otherwise (200), archived meters included, which stay archived. Only the fields you send change, each with the meaning PATCH /v1/meters/{id} gives it; event_name and unit_label cannot change after create, and a different value is ignored with a field_not_writable warning. The request is compared with the stored meter first, so a request that changes nothing answers unchanged and writes nothing, also on a locked meter, and retrying after a timeout is safe; only a real change of a locked meter's filter or aggregation answers 409 meter_immutable. The meter comes back with write_result. Send If-None-Match: * to create only.\",\"dateModified\":\"2026-11-26T18:21:07.748Z\",\"isPartOf\":{\"@id\":\"https://docs.creem.io#website\"},\"breadcrumb\":{\"@id\":\"https://docs.creem.io/api-reference/endpoint/create-meter#breadcrumb\"}},{\"@type\":\"BreadcrumbList\",\"@id\":\"https://docs.creem.io/api-reference/endpoint/create-meter#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Features\",\"item\":\"https://docs.creem.io/features/checkout/checkout-api\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Create a meter\",\"item\":\"https://docs.creem.io/api-reference/endpoint/create-meter\"}]},{\"@type\":[\"TechArticle\",\"APIReference\"],\"@id\":\"https://docs.creem.io/api-reference/endpoint/create-meter#apireference\",\"headline\":\"Create a meter\",\"name\":\"Create a meter\",\"description\":\"Define how a stream of usage events is aggregated into billable units. The unit label doubles as the display unit and as the credit bucket the meter settles into. A duplicate name within the store is rejected with 409 meter_name_taken. With an external_id the call is an upsert: it creates the meter when the key is new (201) and updates the meter that holds the key otherwise (200), archived meters included, which stay archived. Only the fields you send change, each with the meaning PATCH /v1/meters/{id} gives it; event_name and unit_label cannot change after create, and a different value is ignored with a field_not_writable warning. The request is compared with the stored meter first, so a request that changes nothing answers unchanged and writes nothing, also on a locked meter, and retrying after a timeout is safe; only a real change of a locked meter's filter or aggregation answers 409 meter_immutable. The meter comes back with write_result. Send If-None-Match: * to create only.\",\"url\":\"https://docs.creem.io/api-reference/endpoint/create-meter\",\"mainEntityOfPage\":{\"@id\":\"https://docs.creem.io/api-reference/endpoint/create-meter#webpage\"},\"dateModified\":\"2026-11-26T18:21:07.748Z\",\"publisher\":{\"@id\":\"https://docs.creem.io/#organization\"},\"isPartOf\":{\"@id\":\"https://docs.creem.io#website\"}}]}\u003c/script>\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@type\":\"WebSite\",\"name\":\"Creem\",\"publisher\":{\"@type\":\"Organization\",\"name\":\"Creem\"},\"provider\":{\"@type\":\"Organization\",\"name\":\"Mintlify\",\"url\":\"https://mintlify.com\"}}\u003c/script>","agentPointerHref":"/api-reference/endpoint/create-meter.md","siteName":"Creem","nav":{"global":{"anchors":[{"anchor":"Community","icon":"discord","href":"https://discord.gg/q3GKZs92Av"},{"anchor":"Blog","icon":"newspaper","href":"https://creem.io/blog"}]},"tabs":[{"tab":"Documentation","groups":[{"group":"Get Started","icon":"rocket","pages":[{"title":"Ship Software. Get Paid Globally.","sidebarTitle":"Introduction","href":""},{"title":"Quickstart","href":"/getting-started/quickstart"},{"title":"Test Mode","href":"/getting-started/test-mode"},{"group":"Account Reviews","pages":[{"title":"Account Reviews","href":"/merchant-of-record/account-reviews/account-reviews"},{"title":"How to Request a Re-Review","href":"/merchant-of-record/account-reviews/re-review-guide"},{"title":"If your account was rejected","href":"/merchant-of-record/account-reviews/rejected-accounts"},{"group":"Gen AI Compliance","pages":[{"title":"Gen AI Requirements","href":"/merchant-of-record/account-reviews/gen-ai-requirements"},{"title":"Technical Integration Guide","href":"/merchant-of-record/account-reviews/gen-ai-technical-integration-guide"},{"title":"AI Wrapper Compliance","href":"/merchant-of-record/account-reviews/ai-wrapper-compliance"}]}]},{"title":"Dashboard Overview","href":"/getting-started/dashboard-overview"},{"group":"Migrate to Creem","pages":[{"title":"Migrate from Lemon Squeezy","sidebarTitle":"Lemon Squeezy","icon":"lemon","tag":"NEW","href":"/getting-started/migrate/lemon-squeezy"},{"title":"Lemon Squeezy migration: technical guide","sidebarTitle":"Lemon Squeezy technical guide","icon":"code","href":"/getting-started/migrate/lemon-squeezy/technical-guide"}]}]},{"group":"AI","icon":"robot","pages":[{"title":"AI Integration","href":"/ai/introduction"},{"group":"For Humans","pages":[{"title":"Getting Started","href":"/ai/for-humans/getting-started"},{"title":"Use Creem in Claude and ChatGPT","href":"/ai/for-humans/ai-assistants"},{"title":"Creem CLI","href":"/ai/for-humans/cli"}]},{"group":"For Agents","pages":[{"title":"Start Without an Account","href":"/ai/for-agents/sandbox"},{"title":"Hosted MCP Server","href":"/ai/for-agents/hosted-mcp"},{"title":"Skill Files","href":"/ai/for-agents/skill-files"},{"title":"Creem CLI","href":"/ai/for-agents/cli"},{"title":"Store Monitoring","href":"/ai/for-agents/store-monitoring"}]}]},{"group":"Features","icon":"sparkles","pages":[{"group":"Checkout","pages":[{"title":"Checkout API","href":"/features/checkout/checkout-api"},{"title":"Checkout Link","href":"/features/checkout/checkout-link"},{"title":"Embedded Checkout","href":"/features/checkout/embedded-checkout"},{"title":"Checkout Customization","href":"/features/checkout/checkout-customization"},{"title":"Checkout Custom Fields","href":"/features/checkout/checkout-custom-fields"},{"title":"Checkout Localization","href":"/features/checkout/checkout-localization"}]},{"title":"One Time Payments","href":"/features/one-time-payment"},{"title":"Pay What You Want","href":"/features/pay-what-you-want"},{"group":"Subscriptions","pages":[{"title":"Subscriptions","href":"/features/subscriptions/introduction"},{"title":"Managing Subscriptions","href":"/features/subscriptions/managing"},{"title":"Refunds and Cancellations","href":"/features/subscriptions/refunds-and-cancellations"}]},{"title":"Seat Based Billing","href":"/features/seat-based-billing"},{"title":"Revenue Splits","href":"/features/split-payments"},{"title":"Affiliate Program","sidebarTitle":"Affiliate Program","href":"/features/affiliate-program"},{"title":"Referral Program","sidebarTitle":"Referral Program","href":"/features/referral-program"},{"title":"Storefronts","href":"/features/storefronts"},{"title":"Sell to AI Agents","sidebarTitle":"Agentic Marketplace","href":"/features/agentic-marketplace"},{"title":"Custom Domains","href":"/features/custom-domains"},{"title":"Short Links","href":"/features/short-links"},{"title":"Discount Codes","href":"/features/discounts"},{"title":"Trials","href":"/features/trials"},{"title":"Customer Portal","href":"/features/customer-portal"},{"title":"Product Bundles","href":"/features/product-bundles"},{"title":"Moderation","href":"/features/moderation"},{"title":"Usage-Based Billing","href":"/features/usage-based-billing"},{"group":"Customer Credits","pages":[{"title":"Customer Credits","sidebarTitle":"Introduction","href":"/features/customer-credits/introduction"},{"title":"Accounts","href":"/features/customer-credits/accounts"},{"title":"Transactions","href":"/features/customer-credits/transactions"},{"title":"Auto-refill","href":"/features/customer-credits/auto-refill"}]},{"group":"Events","pages":[{"title":"Ingest usage events","openapi":"post /v1/events/ingest","href":"/api-reference/endpoint/ingest-usage-events"},{"title":"Preview usage events","openapi":"post /v1/events/preview","href":"/api-reference/endpoint/preview-usage-events"},{"title":"List usage events","description":"List the usage events your store has ingested, oldest first in ingestion order, as a forward cursor page. Filters compose: by meter (resolved to the meter's event name), by customer, and by `reference` (the `event_id` you supplied). Events are returned raw — a meter's filter clauses are not applied. Usage events are append-only, so pagination is forward-only and there is no `ending_before`.","openapi":"get /v1/events","href":"/api-reference/endpoint/list-usage-events"}]},{"group":"Meters","pages":[{"title":"Create a meter","openapi":"post /v1/meters","href":"/api-reference/endpoint/create-meter"},{"title":"List meters","description":"List your meters, newest first, as a cursor page. Archived meters are hidden unless include_archived=true.","openapi":"get /v1/meters","href":"/api-reference/endpoint/list-meters"},{"title":"Retrieve a meter","openapi":"get /v1/meters/{id}","href":"/api-reference/endpoint/get-meter"},{"title":"Update a meter","openapi":"patch /v1/meters/{id}","href":"/api-reference/endpoint/update-meter"},{"title":"Preview an unsaved meter definition","openapi":"post /v1/meters/preview","href":"/api-reference/endpoint/preview-meter"},{"title":"Preview an existing meter","openapi":"post /v1/meters/{id}/preview","href":"/api-reference/endpoint/preview-existing-meter"},{"title":"Get consumed units for a customer","openapi":"get /v1/meters/{id}/consumed","href":"/api-reference/endpoint/get-meter-consumed-units"},{"title":"Archive a meter","openapi":"post /v1/meters/{id}/archive","href":"/api-reference/endpoint/archive-meter"},{"title":"Unarchive a meter","openapi":"post /v1/meters/{id}/unarchive","href":"/api-reference/endpoint/unarchive-meter"}]},{"group":"Addons","pages":[{"title":"License Keys","href":"/features/addons/licenses"},{"title":"Private Notes","href":"/features/addons/private-notes"},{"title":"File Downloads","href":"/features/addons/file-downloads"},{"title":"GitHub Repository Access","icon":"github","href":"/features/addons/github-repository-access"},{"title":"Abandoned Cart Recovery","href":"/features/addons/abandoned-cart-recovery"}]}]},{"group":"Code","icon":"code","pages":[{"group":"SDKs","pages":[{"title":"TypeScript","href":"/code/sdks/typescript"},{"title":"Next.js adapter","href":"/code/sdks/nextjs"},{"group":"Better Auth","pages":[{"title":"Overview","href":"/code/sdks/better-auth"},{"title":"Quickstart","href":"/code/sdks/better-auth/quickstart"},{"title":"Configuration","href":"/code/sdks/better-auth/configuration"},{"title":"Client API","href":"/code/sdks/better-auth/client"},{"title":"Webhooks and access","href":"/code/sdks/better-auth/webhooks"},{"title":"Server API","href":"/code/sdks/better-auth/server"},{"title":"Migration","href":"/code/sdks/better-auth/migration"}]},{"group":"Convex","pages":[{"title":"Quickstart","href":"/code/sdks/convex/quickstart"},{"title":"Concepts","href":"/code/sdks/convex/concepts"},{"title":"Subscriptions","href":"/code/sdks/convex/subscriptions"},{"title":"One-Time Products \u0026 Credits","href":"/code/sdks/convex/one-time-and-credits"},{"title":"Entitlements \u0026 Account UI","href":"/code/sdks/convex/entitlements"},{"title":"Advanced","href":"/code/sdks/convex/advanced"},{"title":"Migration","href":"/code/sdks/convex/migration"},{"title":"Component Reference","href":"/code/sdks/convex/reference"}]},{"title":"Creem Next.js Template","href":"/code/sdks/templates"},{"title":"AI Agents","href":"/code/sdks/ai-agents"}]},{"title":"Creem CLI","href":"/code/cli"},{"title":"Promote test to live","href":"/code/cli-promote"},{"title":"Webhooks","href":"/code/webhooks"}]},{"group":"Integrations","icon":"link","pages":[{"group":"Affiliate programs","pages":[{"title":"Affonso Affiliate Program Integration","sidebarTitle":"Affonso","href":"/integrations/affonso"},{"title":"LinkJolt Affiliate Program Integration","sidebarTitle":"LinkJolt","href":"/integrations/linkjolt"},{"title":"Referly Affiliate Program Integration","sidebarTitle":"Referly","href":"/integrations/referly"},{"title":"Refgrow Affiliate Program Integration","sidebarTitle":"Refgrow","href":"/integrations/refgrow"},{"title":"Rekomi Affiliate Program Integration","sidebarTitle":"Rekomi","href":"/integrations/rekomi"}]},{"title":"Evendeals","href":"/integrations/evendeals"},{"title":"Framer","href":"/integrations/framer"},{"title":"Strapi","href":"/integrations/strapi"}]},{"group":"Community","icon":"users","pages":[{"title":"Community Resources","href":"/code/community/community-resources"}]},{"group":"Merchant of Record","icon":"building","pages":[{"title":"What is a Merchant of Record","href":"/merchant-of-record/what-is"},{"title":"Supported Countries","href":"/merchant-of-record/supported-countries"},{"group":"Finance","pages":[{"title":"Payouts","href":"/merchant-of-record/finance/payouts"},{"title":"Payout Accounts","href":"/merchant-of-record/finance/payout-accounts"},{"title":"Refunds and Chargebacks","href":"/merchant-of-record/finance/refunds-and-chargebacks"},{"title":"Payments","href":"/merchant-of-record/finance/payment-methods"}]}]},{"group":"For Customers","icon":"circle-question","pages":[{"title":"Why did Creem charge me","href":"/for-customers/why-creem-charged-me"},{"title":"How to cancel a subscription","href":"/for-customers/how-to-cancel-subscription"},{"title":"How to update payment method","href":"/for-customers/how-to-update-payment-method"},{"title":"I can't log in to the Customer Portal","href":"/for-customers/cant-log-in-to-customer-portal"}]}]},{"tab":"Guides","pages":[{"title":"Guides","href":"/guides/introduction"}]},{"tab":"API Reference","pages":[{"title":"API Reference","href":"/api-reference/introduction"}]}]},"basePath":"","title":"Create a meter - Creem","deploymentId":"dpl_EwfxjeKENdVkfzdag8rM6mKzcTUJ","buildId":"dpl_EwfxjeKENdVkfzdag8rM6mKzcTUJ","dynamics":["c2aa737661","2b790eda92","b0f84f53ff","a9bb46feb3"],"chunks":["OpenApiReferenceProvider-B8kPdtB2.js","snippetPresets-C-p1aFQ1.js","utils-B9NnUZSZ.js","style-to-object-BY3JEAdk.js","utils-DFxl7cW2.js","v4-DIgz8zy6.js","addTypeLabelsToSchema-bSr9h7OB.js","conditional-requirements-CFM0id0Q.js","cloneDeep-Bw4Gcy_r.js","_Uint8Array-C68x8Gny.js","isObject-FP1Yky1u.js","ApiExamples-BXsp8PHs.js","usePlaygroundInputsStore-BlAOLmIF.js","shallow-C2F02mqa.js","isEqual-C8iG4q2G.js","CodeSnippets-45lHR04X.js","CodeSnippet-6Cemznl-.js","use-playground-group-access-Cyy8SXp5.js","Page-CeZ_ZB5X.js","api-description-markdown-DiOdv5rp.js","DynamicMarkdown-B_9ywLDq.js","SectionHeading-Cc2r-uqU.js","MethodPill-Df3Tcu4c.js","getPastedJson-B3vrV0wE.js","Check2Icon-YQhSFafd.js","axios-CsQoIw0U.js","Markdown-0RkHcMOI.js","AssistantPageLink-DeJZCj9t.js","dist-DVqS175j.js","lib-DMeTj1gb.js","lib-B8HbPgcC.js","katex-Dbtb6Wk7.js","html-void-elements-mCSPHezU.js","marked.esm-CZWythHk.js"]}