Custom Fields

Create Metafields

POST
/{resource_type}/metafields.json

Creates metafields on a Site for either the Subscriptions or Customers resource.

Metafields and their metadata are created in the Custom Fields configuration page on your Site. Metafields can be populated with metadata when you create them or later with the Update Metafield, Create Metadata, or Update Metadata endpoints. The Create Metadata and Update Metadata endpoints allow you to add metafields and metadata values to a specific subscription or customer.

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

Note: After creating a metafield, the resource type cannot be modified.

In the UI and product documentation, metafields and metadata are called Custom Fields.

  • Metafield is the custom field
  • Metadata is the data populating the custom field.

See Custom Fields Reference and Custom Fields Tab for information on using Custom Fields in the Advanced Billing UI.

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"

Request Body

application/json

metafields*|array<>

Response Body

application/json

application/json

curl -X POST "https://example.com/subscriptions/metafields.json" \  -H "Content-Type: application/json" \  -d '{    "metafields": {      "name": "Dropdown field",      "input_type": "dropdown",      "enum": [        "option 1",        "option 2"      ],      "scope": {        "csv": "0",        "invoices": "0",        "statements": "0",        "portal": "1"      }    }  }'
[  {    "name": "Color",    "scope": {      "csv": "0",      "statements": "0",      "invoices": "0",      "portal": "0"    },    "data_count": 0,    "input_type": "text",    "enum": null  },  {    "name": "Brand",    "scope": {      "csv": "0",      "statements": "0",      "invoices": "0",      "portal": "0"    },    "data_count": 0,    "input_type": "text",    "enum": null  }]