---
title: "Create a subscription for a client"
method: POST
path: "/clients/{id}/subscriptions"
tags: ["Agencies"]
---

# Create a subscription for a client

`POST /clients/{id}/subscriptions`

## Request

- Base URL: `https://api.hypamoon.com/api/v1`
- URL: `https://api.hypamoon.com/api/v1/clients/{id}/subscriptions`
- Auth: one of:
  - HTTP bearer
  - OAuth 2 (authorization code, authorization URL `https://app.hypamoon.com/oauth/authorize`, token URL `https://api.hypamoon.com/oauth/token`, scopes: `clients:write`)

A subscription on your agency's own payment account, with the client project in the metadata: the payer pays the first period through checkout_url, which also sets up the mandate; after that the payment provider charges every month or year. Not every payment account supports this yet; a 409 says so. Events: client_subscription.active, client_subscription.payment_paid, client_subscription.payment_failed and client_subscription.canceled.

## Path parameters

- `id` string, uuid, required

## Request body

- object
  - `amount_cents` integer, required
  - `currency` string
  - `description` string, required
  - `redirect_url` string, uri, required
  - `idempotency_key` string
  - `interval` 'month' | 'year', required
  - `email` string, email, required
  - `name` string

## Response `200`

The subscription made earlier with this idempotency_key.

- object
  - `object` 'client_payment_link' | 'client_subscription', required
  - `id` string, uuid, required
  - `client_project_id` string, uuid, required
  - `status` 'open' | 'paid' | 'failed' | 'expired' | 'active' | 'canceled', required
  - `amount_cents` integer, required
  - `fee_cents` integer, required
  - `currency` string, required
  - `description` string, required
  - `interval` 'month' | 'year' | 'null', nullable
  - `paid_until` string, nullable
  - `canceled_at` string, nullable
  - `test` boolean, required
  - `checkout_url` string, nullable, required
  - `paid_at` string, nullable, required
  - `created_at` string, required

## Other responses

- `201`: The subscription, open until the first payment.
- `400`: Bad Request: invalid_json.
- `401`: Unauthorized: unauthorized, missing_api_key, invalid_api_key, api_key_revoked, project_deleted.
- `403`: Forbidden: project_not_enabled, key_mode_mismatch, missing_scope, verification_required, forbidden.
- `404`: Not Found: not_found.
- `409`: Conflict: conflict.
- `422`: Unprocessable Content: validation_failed.
- `429`: Too Many Requests: rate_limited.
- `500`: Internal Server Error: internal_error.
- `502`: Bad Gateway: upstream_error.
- `503`: Service Unavailable: service_unavailable.

---

[API](https://skmtc.dev/hypamoon/apis/hypamoon-api.md) · [All operations](https://skmtc.dev/hypamoon/apis/hypamoon-api/llms.txt) · [OpenAPI document](https://skmtc.dev/hypamoon/apis/hypamoon-api/revisions/9f0b90004c06?raw)
