Recurly Measured Units API
The measured-units API from Recurly — 2 operation(s) for measured-units.
The measured-units API from Recurly — 2 operation(s) for measured-units.
Every API here is available over the APIs.io API and to AI agents over MCP.
One button, every client — Claude, Cursor, VS Code and the rest.
https://apis.io/mcp
find_apisBrowse and filter every API in the catalog.get_api_artifactsOne API's artifacts, grouped by type.get_openapiThe primary OpenAPI for this API.find_similar_apisAPIs that look like this one.apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.resolveTurn a domain, URL or GitHub org into the provider it belongs to.find_cohortsEvery scored population of providers in the catalog.curl "https://apis.io/api/v1/apis/recurly:recurly-measured-units-api"
curl "https://apis.io/api/v1/apis?limit=25"
Calls without X-API-Key need no key. Calls with it need a paid plan — get a key.
Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. See our Privacy Policy and Terms.
A second provider on the same verified email joins the account you already have.
openapi: 3.2.0
info:
title: Recurly V2 Measured Units API
description: '# Getting Started
Welcome to the reference documentation for Recurly''s XML API v2. Here you will find a complete
reference for all API v2 operations. If you''re building a new product, or just getting started with Recurly, we recommend
using our newer JSON API v3. Now let''s get started with API v2. # Authentication
##### API Authentication (HTTP Basic)
Recurly uses HTTP Basic Authentication—your Private API key is securely encrypted by the SSL channel. If you are testing the API calls via the command line with cURL, try:
```
curl -H ''Accept: application/xml'' \
-H ''X-Api-Version: 2.29'' \
-H ''Content-Type: application/xml; charset=utf-8'' \
-u ''[apikey]'' \
https://[subdomain].recurly.com/v2/accounts
```
Replace `[apikey]` and `[subdomain]` with the appropriate values for your site. ##### Calculating your own authorization header
Most programming languages encode the authorization header automatically. With HTTP Basic Authentication, the `Authorization` header is a string containing a Base-64 encoded username and password. In the case of Recurly''s API, you need only specify the username as your API key. If your library requires a password, set it to an empty string. ```
"Authorization": "Basic " + base64_encode(API Key)
```
##### Additional Request Headers
**Accept Header**
Recurly API v2 returns results as XML. Your requests should always include the header requesting the results as XML:
```
Accept: application/xml
```
**Content-Type Header**
When sending data to Recurly in a POST or PUT request, your request must specify the content type of your request:
```
Content-Type: application/xml; charset=utf-8
```
**X-Api-Version Header**
When sending data to Recurly, your request should specify the API version you''re attempting to interact with:
```
X-Api-Version: 2.29
```
You learn more about the different versions in the API Versioning section. ##### Public API Key
Recurly uses two types of API keys: public and private. The Public API key is used by Recurly.js to identify its requests as belonging to your Recurly site. This key can be safely included in Javascript code. Recurly provides each site with one Public Key. The Public API Key can be regenerated on the API Credentials page. ##### Private API Keys
###### Treat your Private API Keys like passwords! The API key allows access to your site''s data. Do not include it in Javascript code exposed to browsers. Recurly supports the use of multiple Private API keys, which can be used to integrate third party services using unique, controlled credentials. **Limits & Pricing**
Merchants on the Starter or grandfathered Recurly plans or merchants in sandbox mode will be granted 5 private API keys. Merchants on Recurly''s Professional plan will be granted 10 private API keys. **Default Key**
Your default private API key should be used to integrate Recurly with your backend systems. There will be at least one key active at all times. **Additional Keys**
Additional private API keys should be used to connect your Recurly data to additional sources, like analytics software, accounting packages, or email tools. Recurly recommends clearly labeling the name of each key to identify the associated vendor. **Regenerating Private API Keys**
Your API key can be regenerated by clicking on the Regenerate button on the API credentials page. When you generate a private API key, you have two options:
1. Block the old key immediately. This is primarily recommended when the security of a key has been compromised. 2. Allow the old key access for 12 hours. This is primarily used when updating systems and a smooth transition between keys is needed. *If a private API key is changed, an email alert will be sent to your Recurly Site Technical Contact.*
**Read-Only Keys**
When creating a private key, you will have the option to set the key to “read-only”. This means the API key may make GET requests but cannot not PUT, POST or DELETE requests.'
version: '2.29'
servers:
- url: https://{subdomain}.{domain}/v2
variables:
subdomain:
description: Subdomain of your Recurly site.
default: my-super-successful-company
domain:
description: Domain of your Recurly site.
default: recurly.com
security:
- api_key: []
tags:
- name: measured-units
x-displayName: Measured Units
paths:
/measured_units:
get:
summary: List Measured Units
description: List all measured units for your site.
tags:
- measured-units
operationId: listMeasuredUnits
parameters: []
responses:
'200':
description: ''
content:
application/xml:
example: "<measured_units type=\"array\">\n <measured_unit href=\"https://your-subdomain.recurly.com/v2/measured_units/454087618196407477\">\n <id type=\"integer\">454087618196407477</id>\n <name>Ad Impressions</name>\n <display_name>Impression</display_name>\n <description>Number of ad impressions</description>\n </measured_unit>\n <measured_unit href=\"https://your-subdomain.recurly.com/v2/measured_units/12345678901234567890\">\n <id type=\"integer\">12345678901234567890</id>\n <name>Streaming Bandwidth</name>\n <display_name>GB</display_name>\n <description>Video steaming bandwidth measured in gigabytes</description>\n </measured_unit>\n</measured_units>"
x-codeSamples:
- lang: PHP
source: "<?php\n\nforeach(Recurly_MeasuredUnitList::get() as $unit) {\n print $unit;\n}"
- lang: Ruby
source: "# List all MeasuredUnits\nmeasured_units = Recurly::MeasuredUnit.all\nmeasured_units.each do |measured_unit|\n puts measured_unit\nend"
- lang: Python
source: "from recurly import MeasuredUnit\n\n# List all MeasuredUnits\nfor measured_unit in MeasuredUnit.all():\n print measured_unit"
- lang: Dotnet
source: var measuredUnits = MeasuredUnits.List();
post:
summary: Create Measured Unit
description: Create a measured unit on your site.
tags:
- measured-units
operationId: createMeasuredUnit
parameters: []
requestBody:
required: true
content:
application/xml:
schema:
type: object
required:
- name
- display_name
properties:
name:
type: string
default: ''
description: Unique internal name of the measured unit on your site.
display_name:
type: string
default: ''
description: Display name for the measured unit. We recommend the singular version. (e.g. - GB, API Call, Email).
description:
type: string
default: ''
description: Optional internal description.
responses:
'200':
description: ''
content:
application/xml:
example: "<measured_unit href=\"https://your-subdomain.recurly.com/v2/measured_units/12345678901234567890\">\n <id type=\"integer\">12345678901234567890</id>\n <name>Streaming Bandwidth</name>\n <display_name>GB</display_name>\n <description>Video steaming bandwidth measured in gigabytes</description>\n</measured_unit>"
schema:
$ref: '#/components/schemas/MeasuredUnit'
x-codeSamples:
- lang: xml
source: "<measured_unit>\n <name>Streaming Bandwidth</name>\n <display_name>GB</display_name>\n <description>Video steaming bandwidth measured in gigabytes</description>\n</measured_unit>"
- lang: PHP
source: '<?php
$unit = new Recurly_MeasuredUnit();
$unit->name = ''Streaming Bandwidth'';
$unit->display_name = ''GB'';
$unit->description = ''Video steaming bandwidth measured in gigabytes'';
$unit->create();'
- lang: Ruby
source: "# Create MeasuredUnit\nmeasured_unit = Recurly::MeasuredUnit.new(\n name: \"Streaming Bandwidth\",\n display_name: \"GB\",\n description: \"Video steaming bandwidth measured in gigabytes\"\n)\nmeasured_unit.save\nputs measured_unit"
- lang: Python
source: "from recurly import MeasuredUnit\n\n# Create a Measured unit\nmeasured_unit = MeasuredUnit(\n name=\"Streaming Bandwidth\",\n display_name=\"GB\",\n description=\"Video steaming bandwidth measured in gigabytes\")\nmeasured_unit.save()\nprint measured_unit"
- lang: Dotnet
source: 'var measuredUnit = new MeasuredUnit("Streaming Bandwidth", "GB", "Video steaming bandwidth measured in gigabytes");
measuredUnit.Create();'
/measured_units/{measured_unit_id}:
get:
summary: Lookup Measured Unit
description: Lookup a specific measured unit for your site. A customer's usage-based add-on and usage records will reference the associated measured unit where you can grab the display name for pricing and usage displays.
tags:
- measured-units
operationId: lookupMeasuredUnit
parameters:
- in: path
name: measured_unit_id
schema:
type: string
default: ''
required: true
description: Unique id of the measured unit on your site.
responses:
'200':
description: ''
content:
application/xml:
example: "<measured_unit href=\"https://your-subdomain.recurly.com/v2/measured_units/454087618196407477\">\n <id type=\"integer\">454087618196407477</id>\n <name>Ad Impressions</name>\n <display_name>Impression</display_name>\n <description>Number of ad impressions</description>\n</measured_unit>"
schema:
$ref: '#/components/schemas/MeasuredUnit'
x-codeSamples:
- lang: PHP
source: '<?php
# Find MeasuredUnit by id
$measured_unit = Recurly_MeasuredUnit::get(404351234712012650);
print $measured_unit;'
- lang: Ruby
source: '# Find MeasuredUnit by id
measured_unit = Recurly::MeasuredUnit.find(404351234712012650)
puts measured_unit'
- lang: Python
source: 'from recurly import MeasuredUnit
# Find MeasuredUnit by id
measured_unit = MeasuredUnit.get(404351234712012650)
print measured_unit'
- lang: Dotnet
source: 'var measuredUnit = MeasuredUnits.Get(454087618196407477);
Console.WriteLine(measuredUnit.Name); // Ad Impressions'
put:
summary: Update Measured Unit
description: Update a measured unit on your site. Updates immediately change the measured unit for any associated plan and subscription usage-based add-ons.
tags:
- measured-units
operationId: updateMeasuredUnit
parameters:
- in: path
name: measured_unit_id
schema:
type: string
default: ''
required: true
description: Unique id of the measured unit on your site.
requestBody:
required: true
content:
application/xml:
schema:
type: object
properties:
name:
type: string
default: ''
description: Unique internal name of the measured unit on your site.
display_name:
type: string
default: ''
description: Display name for the measured unit. We recommend the singular version. (e.g. - GB, API Call, Email).
description:
type: string
default: ''
description: Optional internal description.
responses:
'200':
description: ''
content:
application/xml:
example: "<measured_unit href=\"https://your-subdomain.recurly.com/v2/measured_units/12345678901234567890\">\n <id type=\"integer\">12345678901234567890</id>\n <name>Streaming Bandwidth</name>\n <display_name>Gigabyte</display_name>\n <description>Video steaming bandwidth measured in gigabytes</description>\n</measured_unit>"
schema:
$ref: '#/components/schemas/MeasuredUnit'
x-codeSamples:
- lang: xml
source: "<measured_unit>\n <display_name>Gigabyte</display_name>\n</measured_unit>"
- lang: Ruby
source: 'measured_unit = Recurly::MeasuredUnit.find ''12345678901234567890''
measured_unit.display_name = "Gigabyte"
measured_unit.save!'
- lang: Dotnet
source: 'var measuredUnit = MeasuredUnits.Get(12345678901234567890);
measuredUnit.DisplayName = "Gigabyte";
measuredUnit.Update();'
delete:
summary: Delete Measured Unit
description: Delete a measured unit on your site. The measured unit must be removed from all plans before it can be deleted.
tags:
- measured-units
operationId: deleteMeasuredUnit
parameters:
- in: path
name: measured_unit_id
schema:
type: string
default: ''
required: true
description: Unique id of the measured unit on your site.
responses:
'204':
description: ''
content:
application/xml:
example: ''
x-codeSamples:
- lang: Ruby
source: 'measured_unit = Recurly::MeasuredUnit.find(12345678901234567890)
measured_unit.destroy'
- lang: Python
source: 'measured_unit = recurly.MeasuredUnit.get(12345678901234567890)
measured_unit.delete()'
- lang: Dotnet
source: 'var measuredUnit = MeasuredUnits.Get(12345678901234567890);
measuredUnit.Delete();'
components:
schemas:
MeasuredUnit:
type: object
properties:
id:
type: integer
description: Unique id of the measured unit on your site.
name:
type: string
description: Unique internal name of the measured unit on your site.
display_name:
type: string
description: Display name for the measured unit. We recommend the singular version. (e.g. - GB, API Call, Email).
description:
type: string
description: Optional internal description.
securitySchemes:
api_key:
type: http
description: Enter the API key as the username and set the password to an empty string. You can locate and manage your API keys from the [API Credentials](https://app.recurly.com/go/developer/api_keys) page.
scheme: basic
x-provenance:
method: harvested
publisher: Recurly
source: https://raw.githubusercontent.com/recurly/recurly-client-ruby/master/openapi/api.yaml
note: split by refine-openapis from the provider's own published document, verified by fetch (openapi/_original/*.fetch.json);
stamped by stamp-openapi-provenance.py (roadmap#793)