Recurly Account Acquisition API
The account-acquisition API from Recurly — 1 operation(s) for account-acquisition.
The account-acquisition API from Recurly — 1 operation(s) for account-acquisition.
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-account-acquisition-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 Account Acquisition 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: account-acquisition
x-displayName: Account Acquisition
paths:
/accounts/{account_code}/acquisition:
post:
summary: Create Account Acquisition
description: Create or update an account's acquisition data.
tags:
- account-acquisition
operationId: createAccountAcquisition
parameters:
- in: path
name: account_code
schema:
type: string
default: ''
required: true
description: Account's unique code.
requestBody:
required: true
content:
application/xml:
schema:
type: object
properties:
cost_in_cents:
type: integer
default: ''
description: Total cost of marketing activities to acquire the customer.
currency:
type: string
default: ''
description: Currency, 3-letter ISO code.
channel:
type: string
default: ''
description: 'The method by which the customer was acquired. Allowed values: `referral`, `social_media`, `email`, `paid_search`, `organic_search`, `direct_traffic`, `marketing_content`, `blog`, `events`, `outbound_sales`, `advertising`, `public_relations`, `other`.'
subchannel:
type: string
default: ''
description: A free-form field to provide additional detail on the acquisition channel.
campaign:
type: string
default: ''
description: Identifier for the marketing campaign used to convert this account.
responses:
'200':
description: ''
content:
application/xml:
example: "<account_acquisition href=\"https://your-subdomain.recurly.com/v2/accounts/1/acquisition\">\n <account href=\"https://your-subdomain.recurly.com/v2/accounts/1\"/>\n <cost_in_cents type=\"integer\">199</cost_in_cents>\n <currency>USD</currency>\n <channel>blog</channel>\n <subchannel>Whitepaper Blog Post</subchannel>\n <campaign>mailchimp67a904de95.0914d8f4b4</campaign>\n <created_at type=\"datetime\">2016-08-12T19:45:14Z</created_at>\n <updated_at type=\"datetime\">2016-08-12T19:45:14Z</updated_at>\n</account_acquisition>"
'400':
description: ''
content:
application/json:
example: '{}'
x-codeSamples:
- lang: xml
source: "<account_acquisition>\n <cost_in_cents type=\"integer\">199</cost_in_cents>\n <currency>USD</currency>\n <channel>blog</channel>\n <subchannel>Whitepaper Blog Post</subchannel>\n <campaign>mailchimp67a904de95.0914d8f4b4</campaign>\n</account_acquisition>"
- lang: PHP
source: '<?php
$acquisition = new Recurly_AccountAcquisition();
$acquisition->account_code = ''1'';
$acquisition->cost_in_cents = 142;
$acquisition->currency = ''USD'';
$acquisition->channel = ''paid_search'';
$acquisition->subchannel = ''Google Ads'';
$acquisition->campaign = ''JSE-2345'';
$acquisition->create();'
- lang: Ruby
source: "account = Recurly::Account.find '1'\n\naccount.account_acquisition = {\n cost_in_cents: 199,\n currency: \"USD\",\n channel: \"blog\",\n subchannel: \"Whitepaper Blog Post\",\n campaign: \"mailchimp67a904de95.0914d8f4b4\"\n}\n\naccount.save"
- lang: Python
source: 'account = recurly.Account.get(''1'')
acquisition = recurly.AccountAcquisition()
acquisition.cost_in_cents = 199
acquisition.currency = ''USD''
acquisition.channel = ''blog''
acquisition.subchannel = ''Whitepaper Blog Post''
acquisition.campaign = ''mailchimp67a904de95.0914d8f4b4''
account.account_acquisition = acquisition
account.save()'
- lang: Dotnet
source: 'var accountAcq = new AccountAcquisition("account-code");
accountAcq.CostInCents = 100;
accountAcq.Currency = "USD";
accountAcq.Channel = AccountAcquisition.AccountAcquisitionChannel.SocialMedia;
accountAcq.Create();'
get:
summary: Lookup Account Acquisition
description: Returns an account's acquisition data.
tags:
- account-acquisition
operationId: lookupAccountAcquisition
parameters:
- in: path
name: account_code
schema:
type: string
default: ''
required: true
description: Account's unique code.
responses:
'200':
description: ''
content:
application/xml:
example: "<account_acquisition href=\"https://your-subdomain.recurly.com/v2/accounts/1/acquisition\">\n <account href=\"https://your-subdomain.recurly.com/v2/accounts/1\"/>\n <cost_in_cents type=\"integer\">199</cost_in_cents>\n <currency>USD</currency>\n <channel>blog</channel>\n <subchannel>Whitepaper Blog Post</subchannel>\n <campaign>mailchimp67a904de95.0914d8f4b4</campaign>\n <created_at type=\"datetime\">2016-08-12T19:45:14Z</created_at>\n <updated_at type=\"datetime\">2016-08-12T19:45:14Z</updated_at>\n</account_acquisition>"
'404':
description: ''
content:
application/xml:
example: "<error>\n <symbol>not_found</symbol>\n <description lang=\"en-US\">Couldn't find AccountAcquisition with account_code = 1</description>\n</error>"
x-codeSamples:
- lang: PHP
source: '<?php
Recurly_AccountAcquisition::get(''1'');'
- lang: Ruby
source: 'account = Recurly::Account.find ''1''
acquisition = account.account_acquisition'
- lang: Python
source: 'account = recurly.Account.get(''1'')
acquisition = account.account_acquisition()'
- lang: Dotnet
source: 'var acquisition = AccountAcquisition.Get("1");
Console.WriteLine(acquisition);'
put:
summary: Update Account Acquisition
description: Create or update an account's acquisition data.
tags:
- account-acquisition
operationId: updateAccountAcquisition
parameters:
- in: path
name: account_code
schema:
type: string
default: ''
required: true
description: Account's unique code.
requestBody:
required: true
content:
application/xml:
schema:
type: object
properties:
cost_in_cents:
type: integer
default: ''
description: Total cost of marketing activities to acquire the customer.
currency:
type: string
default: ''
description: Currency, 3-letter ISO code.
channel:
type: string
default: ''
description: 'The method by which the customer was acquired. Allowed values: `referral`, `social_media`, `email`, `paid_search`, `organic_search`, `direct_traffic`, `marketing_content`, `blog`, `events`, `outbound_sales`, `advertising`, `public_relations`, `other`.'
subchannel:
type: string
default: ''
description: A free-form field to provide additional detail on the acquisition channel.
campaign:
type: string
default: ''
description: Identifier for the marketing campaign used to convert this account.
responses:
'200':
description: ''
content:
application/xml:
example: "<account_acquisition href=\"https://your-subdomain.recurly.com/v2/accounts/1/acquisition\">\n <account href=\"https://your-subdomain.recurly.com/v2/accounts/1\"/>\n <cost_in_cents type=\"integer\">150</cost_in_cents>\n <currency>EUR</currency>\n <channel>blog</channel>\n <subchannel>Whitepaper Blog Post</subchannel>\n <campaign>mailchimp67a904de95.0914d8f4b4</campaign>\n <created_at type=\"datetime\">2016-08-12T19:49:43Z</created_at>\n <updated_at type=\"datetime\">2016-08-12T19:49:55Z</updated_at>\n</account_acquisition>"
'400':
description: ''
content:
application/json:
example: '{}'
x-codeSamples:
- lang: xml
source: "<account_acquisition>\n <cost_in_cents type=\"integer\">150</cost_in_cents>\n <currency>EUR</currency>\n</account_acquisition>"
- lang: PHP
source: '<?php
$acquisition = Recurly_AccountAcquisition::get($account_code);
$acquisition->currency = ''EUR'';
$acquisition->cost_in_cents = 150;
$acquisition->update();'
- lang: Ruby
source: "account = Recurly::Account.find '1'\n\naccount.account_acquisition = {\n cost_in_cents: 200\n}\n\naccount.save!"
- lang: Python
source: 'account = recurly.Account.get(''1'')
acquisition = account.account_acquisition()
acquisition.cost_in_cents = 150
acquisition.currency = ''EUR''
acquisition.save()'
- lang: Dotnet
source: 'var acquisition = AccountAcquisition.Get("1");
acquisition.CostInCents = 200;
acquisition.Update();'
delete:
summary: Clear Account Acquisition
description: Remove an account's acquisition data.
tags:
- account-acquisition
operationId: clearAccountAcquisition
parameters:
- in: path
name: account_code
schema:
type: string
default: ''
required: true
description: Account's unique code.
responses:
'204':
description: ''
content:
application/xml:
example: ''
'404':
description: ''
content:
application/xml:
example: "<error>\n <symbol>not_found</symbol>\n <description lang=\"en-US\">Couldn't find AccountAcquisition with account_code = 1</description>\n</error>"
x-codeSamples:
- lang: PHP
source: '<?php
Recurly_AccountAcquisition::deleteForAccount(''1'');'
- lang: Ruby
source: "if acquisition = account.account_acquisition\n acquisition.destroy\nend"
- lang: Python
source: acquisition.delete()
- lang: Dotnet
source: 'var account = Accounts.Get("1");
account.DeleteAccountAcquisition();'
components:
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