# Subscriptions

Subscriptions

## GET /api/c1/subscriptions

> Get all subscriptions

```json
{"openapi":"3.1.0","info":{"title":"Plock external API","version":"0.2.1"},"tags":[{"name":"Subscriptions","description":"Subscriptions"}],"servers":[{"url":"https://api.plock.io","description":"Production"},{"url":"https://test-api.plock.io","description":"Test"}],"security":[{"bearer":[]}],"components":{"securitySchemes":{"bearer":{"type":"http","scheme":"bearer","bearerFormat":"JWT"}},"schemas":{"JsonApiMeta":{"properties":{"page":{"properties":{"currentPage":{"type":"integer"},"from":{"type":"integer"},"lastPage":{"type":"integer"},"perPage":{"type":"integer"},"to":{"type":"integer"},"total":{"type":"integer"}},"type":"object"}},"type":"object"},"JsonApiVersion":{"properties":{"version":{"type":"string"}},"type":"object"},"JsonApiLinks":{"properties":{"first":{"type":"string"},"last":{"type":"string"},"next":{"type":"string"}},"type":"object"},"Subscriptions":{"properties":{"type":{"type":"string"},"id":{"type":"string"},"attributes":{"properties":{"accountId":{"title":"Account ID","description":"Account ID","type":"string"},"crmDealId":{"title":"CRM Deal ID","description":"CRM Deal ID","type":"string"},"name":{"title":"name","description":"Name of the subscription","type":"string"},"billingInterval":{"title":"billingInterval","description":"Billing interval","type":"string"},"billingIntervalName":{"title":"billingIntervalName","description":"Billing interval name","type":"string"},"billingPractice":{"title":"billingPractice","description":"Billing practice","type":"string"},"state":{"title":"state","description":"State of this subscription","type":"string"},"billingIntervalCount":{"title":"billingIntervalCount","description":"Interval counter","type":"integer"},"isActive":{"title":"isActive","description":"Is this subscription active?","type":"boolean"},"billingCycleAnchor":{"title":"billingCycleAnchor","description":"Anchor date / start date for subscription","type":"string","format":"date-time"},"renewalDate":{"title":"renewalDate","description":"Renewal date for this subscription","type":["string","null"],"format":"date-time"},"renewalTerm":{"title":"renewalTerm","description":"Renewal term (in months)","type":["integer","null"]},"cancelEndDate":{"title":"cancelEndDate","description":"End date to cancel this subscription","type":["string","null"],"format":"date-time"},"cancelPeriod":{"title":"cancelPeriod","description":"Cancellation period (in months)","type":"integer"},"rebateEndDate":{"title":"rebateEndDate","description":"End date for rebate","type":["string","null"],"format":"date-time"},"rebateAmount":{"title":"rebateAmount","description":"Rebate amount","type":["integer","null"]},"rebateType":{"title":"rebateType","description":"Rebate type","type":["string","null"]},"currency":{"title":"currency","description":"Currency","type":"string"},"minimumCommitment":{"title":"minimumCommitment","description":"Minimum commitment","type":["integer","null"]},"currentBillingPeriod":{"title":"currentBillingPeriod","description":"Current active billing period","type":"string"},"autoSendToAccounting":{"title":"autoSendToAccounting","description":"Automatically send invoices for this subscription","type":"boolean"},"endDate":{"title":"endDate","description":"End date for subscription","type":["string","null"],"format":"date-time"},"signedAt":{"title":"signedAt","description":"Date when the subscription was signed/contracted","type":["string","null"],"format":"date-time"},"endDateNoticedAt":{"title":"endDateNoticedAt","description":"Date when end/cancellation was noticed","type":["string","null"],"format":"date-time"},"metaData":{"title":"metaData","description":"Free-form metadata for the subscription","type":["object","null"]},"createdAt":{"title":"createdAt","type":"string","format":"date-time"},"updatedAt":{"title":"updatedAt","type":"string","format":"date-time"},"nextIndexationDate":{"title":"nextIndexationDate","description":"Next indexation date for subscription","type":["string","null"],"format":"date-time"},"indexationPercentage":{"title":"indexationPercentage","description":"Indexation percentage that will be applied on nextIndexationDate","type":["number","null"]},"stats":{"$ref":"#/components/schemas/SubscriptionStats","description":"Subscription financial statistics, these will be variable length arrays where each item represents the value at a month and the last item of the array represents the value at the previous month (now -1 month)"}},"type":"object"},"relationships":{"$ref":"#/components/schemas/SubscriptionsRelationships"},"links":{"$ref":"#/components/schemas/JsonApiLinksSingle"}},"type":"object"},"SubscriptionStats":{"properties":{"mrr_committed_fees":{"type":"array","items":{"type":"number"}},"mrr_usage_fees":{"type":"array","items":{"type":"number"}},"mrr_one_time_fees":{"type":"array","items":{"type":"number"}},"billings_committed_fees":{"type":"array","items":{"type":"number"}},"billings_usage_fees":{"type":"array","items":{"type":"number"}},"billings_one_time_fees":{"type":"array","items":{"type":"number"}}},"type":"object"},"SubscriptionsRelationships":{"properties":{"accounts":{"type":"string"},"invoices":{"type":"string"},"subscription-items":{"type":"string"}},"type":"object"},"JsonApiLinksSingle":{"properties":{"self":{"type":"string"}},"type":"object"},"JsonApiErrors":{"properties":{"detail":{"type":"string"},"status":{"type":"string"},"title":{"type":"string"}},"type":"object"}}},"paths":{"/api/c1/subscriptions":{"get":{"tags":["Subscriptions"],"summary":"Get all subscriptions","operationId":"getSubscriptions","parameters":[{"name":"page","in":"query","description":"Pagination number and size","required":false,"style":"deepObject","explode":true,"schema":{"properties":{"size":{"description":"Number of objects returned per page","type":"integer"},"number":{"description":"Page number","type":"integer"}},"type":"object"}},{"name":"Accept","in":"header","description":"The client must specify an Accept header.","required":true,"schema":{"type":"string","enum":["application/vnd.api+json"]}}],"responses":{"200":{"description":"OK","content":{"application/vnd.api+json":{"schema":{"properties":{"meta":{"$ref":"#/components/schemas/JsonApiMeta"},"jsonapi":{"$ref":"#/components/schemas/JsonApiVersion"},"links":{"$ref":"#/components/schemas/JsonApiLinks"},"data":{"type":"array","items":{"$ref":"#/components/schemas/Subscriptions"}}},"type":"object"}}}},"401":{"description":"Unauthorized","content":{"application/vnd.api+json":{"schema":{"properties":{"jsonapi":{"$ref":"#/components/schemas/JsonApiVersion"},"errors":{"type":"array","items":{"$ref":"#/components/schemas/JsonApiErrors"}}},"type":"object"}}}}}}}}}
```

## GET /api/c1/subscriptions/{subscriptionId}

> Get specific subscription

```json
{"openapi":"3.1.0","info":{"title":"Plock external API","version":"0.2.1"},"tags":[{"name":"Subscriptions","description":"Subscriptions"}],"servers":[{"url":"https://api.plock.io","description":"Production"},{"url":"https://test-api.plock.io","description":"Test"}],"security":[{"bearer":[]}],"components":{"securitySchemes":{"bearer":{"type":"http","scheme":"bearer","bearerFormat":"JWT"}},"schemas":{"JsonApiVersion":{"properties":{"version":{"type":"string"}},"type":"object"},"JsonApiLinksSingle":{"properties":{"self":{"type":"string"}},"type":"object"},"Subscriptions":{"properties":{"type":{"type":"string"},"id":{"type":"string"},"attributes":{"properties":{"accountId":{"title":"Account ID","description":"Account ID","type":"string"},"crmDealId":{"title":"CRM Deal ID","description":"CRM Deal ID","type":"string"},"name":{"title":"name","description":"Name of the subscription","type":"string"},"billingInterval":{"title":"billingInterval","description":"Billing interval","type":"string"},"billingIntervalName":{"title":"billingIntervalName","description":"Billing interval name","type":"string"},"billingPractice":{"title":"billingPractice","description":"Billing practice","type":"string"},"state":{"title":"state","description":"State of this subscription","type":"string"},"billingIntervalCount":{"title":"billingIntervalCount","description":"Interval counter","type":"integer"},"isActive":{"title":"isActive","description":"Is this subscription active?","type":"boolean"},"billingCycleAnchor":{"title":"billingCycleAnchor","description":"Anchor date / start date for subscription","type":"string","format":"date-time"},"renewalDate":{"title":"renewalDate","description":"Renewal date for this subscription","type":["string","null"],"format":"date-time"},"renewalTerm":{"title":"renewalTerm","description":"Renewal term (in months)","type":["integer","null"]},"cancelEndDate":{"title":"cancelEndDate","description":"End date to cancel this subscription","type":["string","null"],"format":"date-time"},"cancelPeriod":{"title":"cancelPeriod","description":"Cancellation period (in months)","type":"integer"},"rebateEndDate":{"title":"rebateEndDate","description":"End date for rebate","type":["string","null"],"format":"date-time"},"rebateAmount":{"title":"rebateAmount","description":"Rebate amount","type":["integer","null"]},"rebateType":{"title":"rebateType","description":"Rebate type","type":["string","null"]},"currency":{"title":"currency","description":"Currency","type":"string"},"minimumCommitment":{"title":"minimumCommitment","description":"Minimum commitment","type":["integer","null"]},"currentBillingPeriod":{"title":"currentBillingPeriod","description":"Current active billing period","type":"string"},"autoSendToAccounting":{"title":"autoSendToAccounting","description":"Automatically send invoices for this subscription","type":"boolean"},"endDate":{"title":"endDate","description":"End date for subscription","type":["string","null"],"format":"date-time"},"signedAt":{"title":"signedAt","description":"Date when the subscription was signed/contracted","type":["string","null"],"format":"date-time"},"endDateNoticedAt":{"title":"endDateNoticedAt","description":"Date when end/cancellation was noticed","type":["string","null"],"format":"date-time"},"metaData":{"title":"metaData","description":"Free-form metadata for the subscription","type":["object","null"]},"createdAt":{"title":"createdAt","type":"string","format":"date-time"},"updatedAt":{"title":"updatedAt","type":"string","format":"date-time"},"nextIndexationDate":{"title":"nextIndexationDate","description":"Next indexation date for subscription","type":["string","null"],"format":"date-time"},"indexationPercentage":{"title":"indexationPercentage","description":"Indexation percentage that will be applied on nextIndexationDate","type":["number","null"]},"stats":{"$ref":"#/components/schemas/SubscriptionStats","description":"Subscription financial statistics, these will be variable length arrays where each item represents the value at a month and the last item of the array represents the value at the previous month (now -1 month)"}},"type":"object"},"relationships":{"$ref":"#/components/schemas/SubscriptionsRelationships"},"links":{"$ref":"#/components/schemas/JsonApiLinksSingle"}},"type":"object"},"SubscriptionStats":{"properties":{"mrr_committed_fees":{"type":"array","items":{"type":"number"}},"mrr_usage_fees":{"type":"array","items":{"type":"number"}},"mrr_one_time_fees":{"type":"array","items":{"type":"number"}},"billings_committed_fees":{"type":"array","items":{"type":"number"}},"billings_usage_fees":{"type":"array","items":{"type":"number"}},"billings_one_time_fees":{"type":"array","items":{"type":"number"}}},"type":"object"},"SubscriptionsRelationships":{"properties":{"accounts":{"type":"string"},"invoices":{"type":"string"},"subscription-items":{"type":"string"}},"type":"object"},"JsonApiErrors":{"properties":{"detail":{"type":"string"},"status":{"type":"string"},"title":{"type":"string"}},"type":"object"}}},"paths":{"/api/c1/subscriptions/{subscriptionId}":{"get":{"tags":["Subscriptions"],"summary":"Get specific subscription","operationId":"getSubscriptionById","parameters":[{"name":"subscriptionId","in":"path","description":"Plock subscription ID","required":true,"schema":{"type":"integer"}},{"name":"page","in":"query","description":"Pagination number and size","required":false,"style":"deepObject","explode":true,"schema":{"properties":{"size":{"description":"Number of objects returned per page","type":"integer"},"number":{"description":"Page number","type":"integer"}},"type":"object"}},{"name":"Accept","in":"header","description":"The client must specify an Accept header.","required":true,"schema":{"type":"string","enum":["application/vnd.api+json"]}}],"responses":{"200":{"description":"OK","content":{"application/vnd.api+json":{"schema":{"properties":{"jsonapi":{"$ref":"#/components/schemas/JsonApiVersion"},"links":{"$ref":"#/components/schemas/JsonApiLinksSingle"},"data":{"$ref":"#/components/schemas/Subscriptions"}},"type":"object"}}}},"401":{"description":"Unauthorized","content":{"application/vnd.api+json":{"schema":{"properties":{"jsonapi":{"$ref":"#/components/schemas/JsonApiVersion"},"errors":{"type":"array","items":{"$ref":"#/components/schemas/JsonApiErrors"}}},"type":"object"}}}},"404":{"description":"Not found","content":{"application/vnd.api+json":{"schema":{"properties":{"jsonapi":{"$ref":"#/components/schemas/JsonApiVersion"},"errors":{"type":"array","items":{"$ref":"#/components/schemas/JsonApiErrors"}}},"type":"object"}}}}}}}}}
```

## GET /api/c1/subscriptions/{subscriptionId}/subscription-items

> Get items for a specific subscription

```json
{"openapi":"3.1.0","info":{"title":"Plock external API","version":"0.2.1"},"tags":[{"name":"Subscriptions","description":"Subscriptions"}],"servers":[{"url":"https://api.plock.io","description":"Production"},{"url":"https://test-api.plock.io","description":"Test"}],"security":[{"bearer":[]}],"components":{"securitySchemes":{"bearer":{"type":"http","scheme":"bearer","bearerFormat":"JWT"}},"schemas":{"JsonApiVersion":{"properties":{"version":{"type":"string"}},"type":"object"},"JsonApiLinksSingle":{"properties":{"self":{"type":"string"}},"type":"object"},"SubscriptionItems":{"properties":{"type":{"type":"string"},"id":{"type":"string"},"attributes":{"properties":{"subscriptionId":{"title":"subscriptionId","description":"ID of the subscription that the subscription item belongs to","type":"string"},"planName":{"title":"planName","description":"Name of the price plan","type":"string"},"productName":{"title":"productName","description":"Name of the product","type":"string"},"quantity":{"title":"quantity","description":"Quantity added","type":["integer","null"]},"rebateAmount":{"title":"rebateAmount","description":"Rebate amount","type":["integer","null"]},"rebateType":{"title":"rebateType","description":"Rebate type","type":["string","null"]},"description":{"title":"description","description":"Description of the subscription item","type":["string","null"]},"costCenter":{"title":"costCenter","description":"Cost center for the subscription item","type":["string","null"]},"project":{"title":"project","description":"Project for the subscription item","type":["string","null"]},"contractedUsage":{"title":"contractedUsage","description":"Contracted usage as defined by the first tier of the price plan","type":["number","null"],"format":"float"},"createdAt":{"title":"createdAt","type":"string","format":"date-time"},"updatedAt":{"title":"updatedAt","type":"string","format":"date-time"}},"type":"object"},"relationships":{"$ref":"#/components/schemas/SubscriptionItemsRelationships"},"links":{"$ref":"#/components/schemas/JsonApiLinksSingle"}},"type":"object"},"SubscriptionItemsRelationships":{"properties":{"subscriptions":{"description":"Note: There is no direct resource route for subscription-items.\nItems are only served as a subscription relationship, via\nSubscriptionController::showRelatedSubscriptionItems() which\nuses getItemsAtDate() to resolve scheduled changes correctly.","type":"string"}},"type":"object"},"JsonApiErrors":{"properties":{"detail":{"type":"string"},"status":{"type":"string"},"title":{"type":"string"}},"type":"object"}}},"paths":{"/api/c1/subscriptions/{subscriptionId}/subscription-items":{"get":{"tags":["Subscriptions"],"summary":"Get items for a specific subscription","operationId":"getSubscriptionItemsBySubscriptionId","parameters":[{"name":"subscriptionId","in":"path","description":"Plock subscription ID","required":true,"schema":{"type":"integer"}},{"name":"page","in":"query","description":"Pagination number and size","required":false,"style":"deepObject","explode":true,"schema":{"properties":{"size":{"description":"Number of objects returned per page","type":"integer"},"number":{"description":"Page number","type":"integer"}},"type":"object"}},{"name":"Accept","in":"header","description":"The client must specify an Accept header.","required":true,"schema":{"type":"string","enum":["application/vnd.api+json"]}}],"responses":{"200":{"description":"OK","content":{"application/vnd.api+json":{"schema":{"properties":{"jsonapi":{"$ref":"#/components/schemas/JsonApiVersion"},"links":{"$ref":"#/components/schemas/JsonApiLinksSingle"},"data":{"type":"array","items":{"$ref":"#/components/schemas/SubscriptionItems"}}},"type":"object"}}}},"401":{"description":"Unauthorized","content":{"application/vnd.api+json":{"schema":{"properties":{"jsonapi":{"$ref":"#/components/schemas/JsonApiVersion"},"errors":{"type":"array","items":{"$ref":"#/components/schemas/JsonApiErrors"}}},"type":"object"}}}},"404":{"description":"Not found","content":{"application/vnd.api+json":{"schema":{"properties":{"jsonapi":{"$ref":"#/components/schemas/JsonApiVersion"},"errors":{"type":"array","items":{"$ref":"#/components/schemas/JsonApiErrors"}}},"type":"object"}}}}}}}}}
```


---

# 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://docs.plock.io/plock-overview/use-cases/for-developers/api/endpoints/subscriptions.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.
