# com.atiproto.subscription

> Published by [atiproto.com](https://lexicon.garden/identity/did:plc:4x5dcv6u4wlkjcssto7f22nu)

✓ This is the authoritative definition for this NSID.

## Links

- [View on Lexicon Garden](https://lexicon.garden/lexicon/did:plc:4x5dcv6u4wlkjcssto7f22nu/com.atiproto.subscription)
- [Documentation](https://lexicon.garden/lexicon/did:plc:4x5dcv6u4wlkjcssto7f22nu/com.atiproto.subscription/docs)
- [Examples](https://lexicon.garden/lexicon/did:plc:4x5dcv6u4wlkjcssto7f22nu/com.atiproto.subscription/examples)

## Definitions

### `com.atiproto.subscription`

**Type**: `record`

A record representing a subscription from one user to another

**Key**: `any`

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `amount` | `integer` | Yes | Subscription amount in cents (0 for free subscriptions) |
| `status` | `string` | Yes | Subscription status |
| `subject` | `string` (did) | Yes | DID of the user being subscribed to |
| `currency` | `string` | Yes | ISO 4217 currency code |
| `interval` | `string` | Yes | Billing interval |
| `createdAt` | `string` (datetime) | Yes | Creation timestamp |
| `accessUntil` | `string` (datetime) | No | Date until which the subscriber retains access after cancellation |
| `cancelledAt` | `string` (datetime) | No | Cancellation timestamp |
| `billingStartDate` | `string` (datetime) | Yes | First billing period, can be used to determine recurrence |

### `com.atiproto.subscription#view`

**Type**: `object`

View of a subscription record for use in API responses

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `uri` | `string` (at-uri) | Yes | AT-URI of the subscription record |
| `amount` | `integer` | Yes | Subscription amount in cents (0 for free subscriptions) |
| `status` | `string` | Yes | Subscription status |
| `subject` | `string` (did) | No | DID of the user being subscribed to |
| `currency` | `string` | Yes | ISO 4217 currency code |
| `interval` | `string` | Yes | Billing interval |
| `createdAt` | `string` (datetime) | Yes | Creation timestamp |
| `accessUntil` | `string` (datetime) | No | Date until which the subscriber retains access after cancellation |
| `cancelledAt` | `string` (datetime) | No | Cancellation timestamp |
| `renewalDate` | `string` (datetime) | No | Next scheduled renewal/billing date. Server-derived from the billing schedule; not stored in PDS. Omitted when not applicable (e.g. cancelled or unauthenticated views). |
| `billingStartDate` | `string` (datetime) | Yes | First billing period, can be used to determine recurrence |

## Raw Schema

```json
{
  "id": "com.atiproto.subscription",
  "defs": {
    "main": {
      "key": "any",
      "type": "record",
      "record": {
        "type": "object",
        "required": [
          "subject",
          "amount",
          "currency",
          "interval",
          "status",
          "billingStartDate",
          "createdAt"
        ],
        "properties": {
          "amount": {
            "type": "integer",
            "minimum": 0,
            "description": "Subscription amount in cents (0 for free subscriptions)"
          },
          "status": {
            "enum": [
              "pending",
              "active",
              "past_due",
              "cancelled",
              "expired"
            ],
            "type": "string",
            "maxLength": 64,
            "description": "Subscription status"
          },
          "subject": {
            "type": "string",
            "format": "did",
            "description": "DID of the user being subscribed to"
          },
          "currency": {
            "type": "string",
            "maxLength": 3,
            "description": "ISO 4217 currency code"
          },
          "interval": {
            "enum": [
              "monthly",
              "yearly"
            ],
            "type": "string",
            "maxLength": 64,
            "description": "Billing interval"
          },
          "createdAt": {
            "type": "string",
            "format": "datetime",
            "description": "Creation timestamp"
          },
          "accessUntil": {
            "type": "string",
            "format": "datetime",
            "description": "Date until which the subscriber retains access after cancellation"
          },
          "cancelledAt": {
            "type": "string",
            "format": "datetime",
            "description": "Cancellation timestamp"
          },
          "billingStartDate": {
            "type": "string",
            "format": "datetime",
            "description": "First billing period, can be used to determine recurrence"
          }
        }
      },
      "description": "A record representing a subscription from one user to another"
    },
    "view": {
      "type": "object",
      "required": [
        "uri",
        "amount",
        "currency",
        "interval",
        "status",
        "billingStartDate",
        "createdAt"
      ],
      "properties": {
        "uri": {
          "type": "string",
          "format": "at-uri",
          "description": "AT-URI of the subscription record"
        },
        "amount": {
          "type": "integer",
          "minimum": 0,
          "description": "Subscription amount in cents (0 for free subscriptions)"
        },
        "status": {
          "enum": [
            "pending",
            "active",
            "past_due",
            "cancelled",
            "expired"
          ],
          "type": "string",
          "maxLength": 64,
          "description": "Subscription status"
        },
        "subject": {
          "type": "string",
          "format": "did",
          "description": "DID of the user being subscribed to"
        },
        "currency": {
          "type": "string",
          "maxLength": 3,
          "description": "ISO 4217 currency code"
        },
        "interval": {
          "enum": [
            "monthly",
            "yearly"
          ],
          "type": "string",
          "maxLength": 64,
          "description": "Billing interval"
        },
        "createdAt": {
          "type": "string",
          "format": "datetime",
          "description": "Creation timestamp"
        },
        "accessUntil": {
          "type": "string",
          "format": "datetime",
          "description": "Date until which the subscriber retains access after cancellation"
        },
        "cancelledAt": {
          "type": "string",
          "format": "datetime",
          "description": "Cancellation timestamp"
        },
        "renewalDate": {
          "type": "string",
          "format": "datetime",
          "description": "Next scheduled renewal/billing date. Server-derived from the billing schedule; not stored in PDS. Omitted when not applicable (e.g. cancelled or unauthenticated views)."
        },
        "billingStartDate": {
          "type": "string",
          "format": "datetime",
          "description": "First billing period, can be used to determine recurrence"
        }
      },
      "description": "View of a subscription record for use in API responses"
    }
  },
  "$type": "com.atproto.lexicon.schema",
  "lexicon": 1
}
```
