Skip to content
Baremetrics

Update Subscription

PUT https://api.baremetrics.com/v1/{source_id}/subscriptions/{oid}

This allows you to update a Subscription, such as changing plans and addons.

Passing an empty "addons" array will remove all addons from this subscription.

[!CAUTION] It may take a while for your updates to appear in your metrics. There may also be a delay in the data being fully displayed in the GET /subscriptions endpoint.

Path parameters

  • oid string required

    Your unique ID for the subscription

  • source_id string required

    Please see Sources

Body

application/json
  • plan_oid string required

    Your unique ID for the plan

  • occurred_at string · date-time

    A unix timestamp of when this change occurred. Defaults to now

    Default "NOW"

  • addons array of objects

    In cents. The OID can be anything you want.

    • oid string required
    • amount integer · int32 required
    • quantity integer · int32 required
  • quantity integer · int32

    Default 1

  • discount integer · int32

    Integer value (in the same currency as the plan)

Responses

200OK
{
  "event": {
    "id": "48X4cZ3T25MKkL",
    "type": "subscription.updated",
    "info": {
      "plan_oid": "1476719008009",
      "occurred_at": 1480421495,
      "quantity": 1,
      "addons": [
        {
          "oid": "addon_1",
          "amount": 100,
          "quantity": 1
        },
        {
          "oid": "addon_2",
          "amount": 50,
          "quantity": 1
        },
        {
          "oid": "addon_3",
          "amount": 25,
          "quantity": 1
        }
      ]
    },
    "occurred_at": 1480421495,
    "received_at": 1480421495
  }
}
400Bad Request
{
  "error": "Error message here"
}