---
updatedAt: 2025-06-09T22:12:34.000Z
agentTools:
  projectIndex: https://developers.baremetrics.com/llms.txt
---

# Create Subscription

This endpoint allows you to create a Subscription.

> ❗️ You will need to create a [Customer](#create-customer) and [Plan](#create-plan) before you can use this endpoint.

> ❗️ It may take a while for your subscriptions to appear in your metrics. There may also be a delay in the data being fully displayed in the [GET /subscriptions](#list-subscriptions) endpoint.

> 🚧 How and why do I use addons?
>
> Addons are used to add additional charges to a base plan. They allow you to create a variety of different combinations of features without creating a separate plan for each possible combination.
>
> *Let's look at a hypothetical way of charging for Baremetrics.*
>
> We could have a base subscription of $25/mo. Additional features like dunning, customer profiles, etc. could be treated as an addon.
>
> $25/mo. base charge + $25 addon for Dunning = $50/mo.

> 📘 We will automatically create charges for your subscriptions. If you don't want this to happen, then please contact us.

# OpenAPI definition

```json
{
  "openapi": "3.1.0",
  "info": {
    "title": "production",
    "version": "1.0"
  },
  "servers": [
    {
      "url": "https://api.baremetrics.com"
    }
  ],
  "components": {
    "securitySchemes": {
      "sec0": {
        "type": "apiKey",
        "in": "header",
        "name": "Authorization",
        "x-bearer-format": "bearer",
        "x-default": "APIKEY"
      }
    }
  },
  "security": [
    {
      "sec0": []
    }
  ],
  "paths": {
    "/v1/{source_id}/subscriptions": {
      "post": {
        "summary": "Create Subscription",
        "description": "This endpoint allows you to create a Subscription.",
        "operationId": "create-subscription",
        "parameters": [
          {
            "name": "source_id",
            "in": "path",
            "description": "Please see [Sources](ref:sources)",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "oid",
                  "started_at",
                  "plan_oid",
                  "customer_oid"
                ],
                "properties": {
                  "oid": {
                    "type": "string",
                    "description": "Your unique ID for the subscription"
                  },
                  "started_at": {
                    "type": "string",
                    "description": "A unix timestamp of when this subscription started",
                    "format": "date-time"
                  },
                  "canceled_at": {
                    "type": "string",
                    "description": "A unix timestamp of when this subscription was, or should be canceled. This cannot be changed, so only set this if you are certain you know when the subscription will end.",
                    "format": "date-time"
                  },
                  "plan_oid": {
                    "type": "string",
                    "description": "Your unique ID for the plan"
                  },
                  "customer_oid": {
                    "type": "string",
                    "description": "Your unique ID for the customer"
                  },
                  "addons": {
                    "type": "array",
                    "items": {
                      "properties": {
                        "oid": {
                          "type": "string"
                        },
                        "amount": {
                          "type": "integer",
                          "format": "int32"
                        },
                        "quantity": {
                          "type": "integer",
                          "format": "int32"
                        }
                      },
                      "required": [
                        "oid",
                        "amount",
                        "quantity"
                      ],
                      "type": "object"
                    }
                  },
                  "quantity": {
                    "type": "integer",
                    "default": 1,
                    "format": "int32"
                  },
                  "discount": {
                    "type": "integer",
                    "description": "Integer value (in the same currency as the plan)",
                    "format": "int32"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "200",
            "content": {
              "application/json": {
                "examples": {
                  "Result": {
                    "value": "{\n  \"event\": {\n    \"id\": \"48X1ZZHtRaBtfN\",\n    \"type\": \"subscription.created\",\n    \"info\": {\n      \"oid\": \"subscription_51\",\n      \"started_at\": 1474381618,\n      \"plan_oid\": \"1476719008009\",\n      \"customer_oid\": \"1476719006346\",\n      \"canceled_at\": null,\n      \"quantity\": 1,\n      \"addons\" : [\n        {\n          \"oid\": \"addon_1\",\n          \"amount\": 100,\n          \"quantity\": 1\n        },\n        {\n          \"oid\": \"addon_2\",\n          \"amount\": 50,\n          \"quantity\": 1\n        }\n      ]\n    },\n    \"occurred_at\": 1474381618,\n    \"received_at\": 1480421211\n  }\n}"
                  }
                },
                "schema": {
                  "type": "object",
                  "properties": {
                    "event": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string",
                          "example": "48X1ZZHtRaBtfN"
                        },
                        "type": {
                          "type": "string",
                          "example": "subscription.created"
                        },
                        "info": {
                          "type": "object",
                          "properties": {
                            "oid": {
                              "type": "string",
                              "example": "subscription_51"
                            },
                            "started_at": {
                              "type": "integer",
                              "example": 1474381618,
                              "default": 0
                            },
                            "plan_oid": {
                              "type": "string",
                              "example": "1476719008009"
                            },
                            "customer_oid": {
                              "type": "string",
                              "example": "1476719006346"
                            },
                            "canceled_at": {},
                            "quantity": {
                              "type": "integer",
                              "example": 1,
                              "default": 0
                            },
                            "addons": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "oid": {
                                    "type": "string",
                                    "example": "addon_1"
                                  },
                                  "amount": {
                                    "type": "integer",
                                    "example": 100,
                                    "default": 0
                                  },
                                  "quantity": {
                                    "type": "integer",
                                    "example": 1,
                                    "default": 0
                                  }
                                }
                              }
                            }
                          }
                        },
                        "occurred_at": {
                          "type": "integer",
                          "example": 1474381618,
                          "default": 0
                        },
                        "received_at": {
                          "type": "integer",
                          "example": 1480421211,
                          "default": 0
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "400",
            "content": {
              "application/json": {
                "examples": {
                  "Result": {
                    "value": "{\n\t\"error\": \"Error message here\"\n}"
                  }
                },
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "example": "Error message here"
                    }
                  }
                }
              }
            }
          }
        },
        "deprecated": false
      }
    }
  },
  "x-readme": {
    "headers": [],
    "explorer-enabled": true,
    "proxy-enabled": false
  },
  "x-readme-fauxas": true
}
```