# Get a subscription

## Get subscription details

> This endpoint retrieves the details of a specific subscription by ID.

```json
{"openapi":"3.0.0","info":{"title":"Subscription API","version":"3.0.0"},"servers":[{"url":"https://api-stg.onekeypayments.com","description":"Staging Server"}],"paths":{"/v3/subscriptions/{subscription_id}":{"get":{"summary":"Get subscription details","description":"This endpoint retrieves the details of a specific subscription by ID.","operationId":"getSubscriptionById","parameters":[{"name":"subscription_id","in":"path","description":"Unique numeric identifier of the subscription to retrieve.","required":true,"schema":{"type":"integer","format":"int64"}},{"name":"Content-Type","in":"header","description":"Media type of the body sent to the API.","required":true,"schema":{"type":"string","default":"application/json"}},{"name":"X-Date","in":"header","description":"ISO8601 Datetime with Timezone (yyyy-MM-dd'T'HH:mm:ssZ)","required":true,"schema":{"type":"string","format":"date-time"}},{"name":"X-Login","in":"header","description":"Merchant X-Login API Key.","required":true,"schema":{"type":"string"}},{"name":"Authorization","in":"header","description":"Authorization control hash.","required":true,"schema":{"type":"string"}},{"name":"X-Idempotency-Key","in":"header","description":"Unique idempotency key for ensuring that the same request is not processed more than once.","required":false,"schema":{"type":"string"}}],"responses":{"200":{"description":"Subscription details retrieved successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Subscription"}}}},"420":{"description":"Subscription does not exist","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"integer"},"description":{"type":"string"},"type":{"type":"string"}}}}}},"500":{"description":"Generic Error","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"integer"},"description":{"type":"string"},"type":{"type":"string"}}}}}}},"tags":["Subscriptions"]}}},"components":{"schemas":{"Subscription":{"type":"object","properties":{"id":{"type":"integer","description":"Unique identifier of the subscription."},"status":{"type":"string","description":"Current status of the subscription.","enum":["PENDING","ACTIVE","COMPLETED","CANCELLED","TERMINATED"]},"start_date":{"type":"string","format":"date","description":"Date when the subscription started or will start."},"end_date":{"type":"string","format":"date","description":"Date when the subscription ended or will end."},"last_renovation_date":{"type":"string","format":"date","description":"Date of the last renovation."},"creation_date":{"type":"string","format":"date-time","description":"Timestamp when the subscription was created."},"subscription_plan":{"type":"string","description":"Frequency plan of the subscription.","enum":["DAILY","WEEKLY","MONTHLY","ANNUALLY"]},"plan_unit":{"type":"integer","description":"The number of units for the subscription plan."},"amount":{"type":"number","format":"double","description":"Amount charged for the subscription."},"auto_renewal":{"type":"boolean","description":"Whether the subscription will automatically renew."},"last_modified_date":{"type":"string","format":"date-time","description":"Timestamp when the subscription was last modified."},"renewals":{"type":"integer","description":"The number of times the subscription has been renewed."},"cancellation_date":{"type":"string","format":"date","nullable":true,"description":"The date the subscription was cancelled."},"currency":{"type":"string","description":"The currency of the subscription amount."},"last_charge_date":{"type":"string","format":"date","description":"The date of the last charge attempt."},"payment_method":{"type":"string","description":"The payment method used for the subscription."},"invoice_id":{"type":"string","description":"The identifier for the invoice."},"error_url":{"type":"string","format":"uri","description":"URL to redirect the user to in case of an error."},"success_url":{"type":"string","format":"uri","description":"URL to redirect the user to upon successful payment."},"back_url":{"type":"string","format":"uri","description":"URL to redirect the user back to your site."},"description":{"type":"string","description":"A brief description of the subscription."},"country":{"type":"string","description":"The two-letter country code (ISO 3166-1 alpha-2)."},"deposits":{"type":"array","description":"A list of all deposits that the subscription has generated.","items":{"$ref":"#/components/schemas/Deposit"}}},"required":["id","status","start_date","creation_date","subscription_plan","plan_unit","amount","auto_renewal","renewals","currency","country"]},"Deposit":{"type":"object","properties":{"deposit_id":{"type":"string","description":"The unique identifier for the deposit."},"status":{"type":"string","description":"The status of the deposit."}},"required":["deposit_id","status"]}}}}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://apidocs.onekeypayments.com/api-reference/deposits-api/manage-subscriptions/get-a-subscription.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
