Custom Fields

Update Metafield

PUT
/{resource_type}/metafields.json

Updates metafields on your Site for a resource type. Depending on the request structure, you can update or add metafields and metadata to the Subscriptions or Customers resource.

With this endpoint, you can:

  • Add metafields. If the metafield specified in current_name does not exist, a new metafield is added.

    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.

  • Change the name of a metafield.

    Note: To keep the metafield name the same and only update the metadata for the metafield, you must use the current metafield name in both the current_name and name parameters.

  • Change the input type for the metafield. For example, you can change a metafield input type from text to a dropdown. If you change the input type from text to a dropdown or radio, you must update the specific subscriptions or customers where the metafield was used to reflect the updated metafield and metadata.

  • Add metadata values to the existing metadata for a dropdown or radio metafield.

    Note: Updates to metadata overwrite. To add one or more values, you must specify all metadata values including the new value you want to add.

  • Add new metadata to a dropdown or radio for a metafield that was created without metadata.

  • Remove metadata for a dropdown or radio for a metafield.

    Note: Updates to metadata overwrite existing values. To remove one or more values, specify all metadata values except those you want to remove.

  • Add or update scope settings for a metafield.

    Note: Scope changes overwrite existing settings. You must specify the complete scope, including the changes you want to make.

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 PUT "https://example.com/subscriptions/metafields.json" \  -H "Content-Type: application/json" \  -d '{}'
[  {    "id": 0,    "name": "string",    "scope": {      "csv": "0",      "invoices": "0",      "statements": "0",      "portal": "0",      "public_show": "0",      "public_edit": "0",      "hosted": [        "string"      ]    },    "data_count": 0,    "input_type": "balance_tracker",    "enum": null  }]