---
title: "Subscribe"
method: POST
path: "/api/v1/payments/subscribe"
tags: ["Payments"]
---

# Subscribe

`POST /api/v1/payments/subscribe`

## Request

- Base URL: `https://cryptodataapi.com`
- URL: `https://cryptodataapi.com/api/v1/payments/subscribe`
- Auth: API key in header `X-API-Key`

Subscribe to a pro plan via x402 payment.

Flow:
1. If active subscription with >7 days remaining → return it (no charge).
2. If no x-payment header → return 402 with payment options.
3. If x-payment header → verify, settle, upgrade key, create subscription + invoice.

## Request body

- SubscribeRequest: Request body for subscribing to a plan.
  - `plan` 'monthly' | 'monthly_plus' | 'annual' | 'annual_plus' | 'pass_1h' | 'pass_1d' | 'pass_7d' | 'pass_1h_plus' | 'pass_1d_plus' | 'pass_7d_plus', required
  - `discount_code` string, nullable

## Response `200`

Successful Response

- unknown

## Other responses

- `422`: Validation Error

---

[API](https://skmtc.dev/cryptodataapi/apis/crypto-data-api.md) · [All operations](https://skmtc.dev/cryptodataapi/apis/crypto-data-api/llms.txt) · [OpenAPI document](https://skmtc.dev/cryptodataapi/apis/crypto-data-api/revisions/8628b754ca81?raw)
