Custom Fields

Create Metadata

POST
/{resource_type}/{resource_id}/metadata.json

Creates metadata and metafields for a specific subscription or customer, or updates metadata values of existing metafields for a subscription or customer. Metadata values are limited to 2 KB in size.

If you create metadata on a subscription or customer with a metafield that does not already exist, the metafield is created with the metadata you specify and it is always added as a text field. You can update the input_type for the metafield with the Update Metafield endpoint.

Note: Each site is limited to 100 unique metafields per resource. This means you can have 100 metafields for Subscriptions and another 100 for Customers.

Authorization

BasicAuth
AuthorizationBasic <token>

The username is a Maxio Chargify API key. The password is x.

In: header

Path Parameters

resource_type*Resource Type

The resource type to which the metafields belong.

Value in

  • "subscriptions"
  • "customers"
resource_id*integer

The Advanced Billing id of the customer or the subscription for which the metadata applies

Request Body

application/json

metadata*array<>

Response Body

application/json

application/json

curl -X POST "https://example.com/subscriptions/0/metadata.json" \  -H "Content-Type: application/json" \  -d '{    "metadata": [      {        "name": "Color",        "value": "Blue"      },      {        "name": "Something",        "value": "Useful"      }    ]  }'
[  {    "id": 0,    "value": "string",    "resource_id": 0,    "name": "string",    "deleted_at": "2019-08-24T14:15:22Z",    "metafield_id": 0  }]