# Baremetrics

> Read subscription analytics and manage API-source customers, plans, subscriptions and annotations.

App · 25 actions. Web page: https://docs.lodol.com/docs/integrations/baremetrics

## Actions

### Cancel subscription

Cancel Subscription.

**Inputs**

- Subscription oid (`subscription_oid`, text, required): Your unique ID for the subscription
- Source (`source_id`, text, required): Please see [Sources](ref:sources)
- Canceled at (`canceled_at`, date and time, required): A unix timestamp of when this subscription was, or should be canceled.

**Outputs**

- `data` (object): Returned value.

**Example output**

```json
{
  "data": {
    "event": {
      "id": "example",
      "info": {
        "addons": [],
        "canceled_at": 1
      },
      "occurred_at": 1,
      "received_at": 1,
      "type": "example"
    }
  }
}
```

### Create annotation

Create Annotation.

**Inputs**

- Metric (`metric`, text, required): Which metric is this for?
- Annotation (`annotation`, text, required): The annotation text
- Date (`date`, date, required): YYYY-MM-DD
- Visible to the whole account (`global_value`, true/false, required): Should this show on all graphs?
- User ID (`user_id_value`, text, required): Who added this annotation?

**Outputs**

- `data` (object): Returned value.

**Example output**

```json
{
  "data": {
    "annotation": {
      "annotation": "example",
      "date": "example",
      "global": false,
      "id": "example",
      "metric": "example",
      "user": {
        "admin": false,
        "email": "example",
        "id": "example",
        "name": "example"
      }
    }
  }
}
```

### Create customer

Create Customer.

**Inputs**

- Source (`source_id`, text, required): Please see [Sources](ref:sources)
- Name (`name`, text): Name.
- Notes (`notes`, text): Your own notes for this customer. These will be displayed in the profile
- Email (`email`, text): An email address for this customer. This is used to lookup extra profile information
- Oid (`oid`, text, required): Your unique ID for the customer
- Created (`created`, date and time): A unix timestamp of when this customer was created. Defaults to now. Default: `NOW`.

**Outputs**

- `data` (object): Returned value.

**Example output**

```json
{
  "data": {
    "customer": {
      "created": 1,
      "current_mrr": 1,
      "current_plans": [],
      "display_image": "example",
      "display_name": "example",
      "email": "example",
      "is_active": false,
      "is_canceled": false,
      "ltv": 1,
      "name": "example",
      "notes": "example",
      "oid": "example",
      "source": "example",
      "source_id": "example"
    }
  }
}
```

### Create plan

Create Plan.

**Inputs**

- Source (`source_id`, text, required): Please see [Sources](ref:sources)
- Oid (`oid`, text, required): Your unique ID for the plan
- Name (`name`, text, required): Your internal name for this plan. This will be displayed in the Plan Breakout section
- Currency (`currency`, text, required): Three-letter ISO currency code, such as USD.
- Amount (`amount`, number, required): How much is this plan? (In cents)
- Interval (`interval`, text, required): day, month or year. One of: `day`, `month`, `year`.
- Interval count (`interval_count`, number, required): Interval count.
- Trial duration (`trial_duration`, number): The duration of this trial. This is to be used in conjunction with trial_duration_unit. Default: `0`.
- Trial duration unit (`trial_duration_unit`, text): This is to be used in conjunction with trial_duration. One of: `day`, `month`, `year`. Default: `day`.

**Outputs**

- `data` (object): Returned value.

**Example output**

```json
{
  "data": {
    "plan": {
      "active": false,
      "amounts": [],
      "created": "example",
      "interval": "example",
      "interval_count": 1,
      "name": "example",
      "oid": "example",
      "setup_fees": 1,
      "source": "example",
      "source_id": "example",
      "trial_duration": "example",
      "trial_duration_unit": "example"
    }
  }
}
```

### Create subscription

Create Subscription.

**Inputs**

- Source (`source_id`, text, required): Please see [Sources](ref:sources)
- Oid (`oid`, text, required): Your unique ID for the subscription
- Started at (`started_at`, date and time, required): A unix timestamp of when this subscription started
- Canceled at (`canceled_at`, date and time): 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.
- Plan oid (`plan_oid`, text, required): Your unique ID for the plan
- Customer oid (`customer_oid`, text, required): Your unique ID for the customer
- Addons (`addons`, list): Addons.
- Quantity (`quantity`, number): Quantity. Default: `1`.
- Discount (`discount`, number): Integer value (in the same currency as the plan)

**Outputs**

- `data` (object): Returned value.

**Example output**

```json
{
  "data": {
    "event": {
      "id": "example",
      "info": {
        "addons": [],
        "canceled_at": "example",
        "customer_oid": "example",
        "oid": "example",
        "plan_oid": "example",
        "quantity": 1,
        "started_at": 1
      },
      "occurred_at": 1,
      "received_at": 1,
      "type": "example"
    }
  }
}
```

### Delete annotation

Delete Annotation.

**Inputs**

- Id (`id`, text, required): Id.

**Outputs**

- `data` (object): Returned value.

**Example output**

```json
{
  "data": {}
}
```

### Delete customer

Delete Customer.

**Inputs**

- Oid (`oid`, text, required): Oid.
- Source (`source_id`, text, required): Please see [Sources](ref:sources)

**Outputs**

- `data` (object): Returned value.

**Example output**

```json
{
  "data": {}
}
```

### Delete plan

Delete Plan.

**Inputs**

- Oid (`oid`, text, required): Oid.
- Source (`source_id`, text, required): Please see [Sources](ref:sources)

**Outputs**

- `data` (object): Returned value.

**Example output**

```json
{
  "data": {}
}
```

### Delete subscription

Delete Subscription.

**Inputs**

- Oid (`oid`, text, required): Oid.
- Source (`source_id`, text, required): Please see [Sources](ref:sources)

**Outputs**

- `data` (object): Returned value.

**Example output**

```json
{
  "data": {}
}
```

### Get account

Get Account.

**Inputs**: None.

**Outputs**

- `data` (object): Returned value.

**Example output**

```json
{
  "data": {}
}
```

### Get annotation

Show Annotation.

**Inputs**

- Id (`id`, text, required): Id.

**Outputs**

- `data` (object): Returned value.

**Example output**

```json
{
  "data": {
    "annotation": {
      "annotation": "example",
      "date": "example",
      "global": false,
      "id": "example",
      "metric": "example",
      "user": {
        "admin": false,
        "email": "example",
        "id": "example",
        "name": "example"
      }
    }
  }
}
```

### Get customer

Show Customer.

**Inputs**

- Oid (`oid`, text, required): Oid.
- Source (`source_id`, text, required): Please see [Sources](ref:sources)

**Outputs**

- `data` (object): Returned value.

**Example output**

```json
{
  "data": {
    "customer": {
      "created": 1,
      "current_mrr": 1,
      "current_plans": [],
      "display_image": "example",
      "display_name": "example",
      "email": "example",
      "is_active": false,
      "is_canceled": false,
      "ltv": 1,
      "name": "example",
      "notes": "example",
      "oid": "example",
      "source": "example",
      "source_id": "example"
    }
  }
}
```

### Get metrics

Show Summary.

**Inputs**

- Start date (`start_date`, date, required): Start date.
- End date (`end_date`, date, required): End date.

**Outputs**

- `data` (object): Returned value.

**Example output**

```json
{
  "data": {
    "metrics": []
  }
}
```

### Get plan

Show Plan.

**Inputs**

- Oid (`oid`, text, required): Oid.
- Source (`source_id`, text, required): Please see [Sources](ref:sources)

**Outputs**

- `data` (object): Returned value.

**Example output**

```json
{
  "data": {
    "plan": {
      "active": false,
      "amounts": [],
      "created": "example",
      "interval": "example",
      "interval_count": 1,
      "name": "example",
      "oid": "example",
      "setup_fees": 1,
      "source": "example",
      "source_id": "example",
      "trial_duration": "example",
      "trial_duration_unit": "example"
    }
  }
}
```

### Get subscription

Show Subscription.

**Inputs**

- Oid (`oid`, text, required): Oid.
- Source (`source_id`, text, required): Please see [Sources](ref:sources)

**Outputs**

- `data` (object): Returned value.

**Example output**

```json
{
  "data": {}
}
```

### List annotations

List Annotations.

**Inputs**: None.

**Outputs**

- `data` (object): Returned value.

**Example output**

```json
{
  "data": {
    "annotations": []
  }
}
```

### List charges

List Charges.

**Inputs**

- Source (`source_id`, text, required): Please see [Sources](ref:sources)
- Start (`start`, date and time): A unix timestamp
- End (`end`, date and time): A unix timestamp
- Subscription oid (`subscription_oid`, text): Subscription oid.
- Customer oid (`customer_oid`, text): Customer oid.

**Outputs**

- `data` (object): Returned value.

**Example output**

```json
{
  "data": {}
}
```

### List customer events

List Customer Events.

**Inputs**

- Source (`source_id`, text, required): Please see [Sources](ref:sources)
- Oid (`oid`, text, required): Oid.

**Outputs**

- `data` (object): Returned value.

**Example output**

```json
{
  "data": {
    "events": []
  }
}
```

### List customers

List Customers.

**Inputs**

- Search (`search`, text): Allows you to search for a customer based on: oid, email, notes and name
- Source (`source_id`, text, required): Please see [Sources](ref:sources)
- Sort (`sort`, text): Allows you to sort the results. You can use ltv or created. Default: `created`.
- Order (`order`, text): Order. One of: `asc`, `desc`. Default: `asc`.

**Outputs**

- `data` (object): Returned value.

**Example output**

```json
{
  "data": {
    "customers": []
  }
}
```

### List events

List Events.

**Inputs**

- Source (`source_id`, text, required): Please see [Sources](ref:sources)
- Live stream (`live_stream`, text): Set this to true to only return events that show up in the live stream. Default: `false`.
- Start (`start`, date and time): Start.
- End (`end`, date and time): End.

**Outputs**

- `data` (object): Returned value.

**Example output**

```json
{
  "data": {}
}
```

### List plans

List Plans.

**Inputs**

- Search (`search`, text): Allows you to search based on the name or oid fields
- Source (`source_id`, text, required): Please see [Sources](ref:sources)

**Outputs**

- `data` (object): Returned value.

**Example output**

```json
{
  "data": {
    "plans": []
  }
}
```

### List refunds

List Refunds.

**Inputs**

- Source (`source_id`, text, required): Please see [Sources](ref:sources)
- Start (`start`, date and time): Start.
- End (`end`, date and time): End.

**Outputs**

- `data` (object): Returned value.

**Example output**

```json
{
  "data": {
    "refunds": []
  }
}
```

### List sources

List Sources.

**Inputs**: None.

**Outputs**

- `data` (object): Returned value.

**Example output**

```json
{
  "data": {
    "sources": []
  }
}
```

### List subscriptions

List Subscriptions.

**Inputs**

- Source (`source_id`, text, required): Please see [Sources](ref:sources)
- Customer oid (`customer_oid`, text): This allows you to return subscriptions for a given customer
- Order (`order`, text): Allows you to order subscriptions from newest to oldest `desc` or oldest to newest `asc`. One of: `asc`, `desc`. Default: `desc`.

**Outputs**

- `data` (object): Returned value.

**Example output**

```json
{
  "data": {}
}
```

### Update customer

Update Customer.

**Inputs**

- Customer oid (`customer_oid`, text, required): Your unique ID for the customer
- Source (`source_id`, text, required): Please see [Sources](ref:sources)
- Name (`name`, text): Name.
- Notes (`notes`, text): Notes.
- Created (`created`, date and time): Unix timestamp of when this customer was created
- Email (`email`, text): Email for this customer

**Outputs**

- `data` (object): Returned value.

**Example output**

```json
{
  "data": {
    "customer": {
      "created": 1,
      "current_mrr": 1,
      "current_plans": [],
      "display_image": "example",
      "display_name": "example",
      "email": "example",
      "is_active": false,
      "is_canceled": false,
      "ltv": 1,
      "name": "example",
      "notes": "example",
      "oid": "example",
      "source": "example",
      "source_id": "example"
    }
  }
}
```
