Skip to main content

Subscriptions

Create a subscription​

POST /subscriptions

Code samples


curl -X POST https://localhost:9543/api-portal/api/v0.9/subscriptions \
-H 'Authorization: Bearer {access_token}' \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-d @payload.json

Creates a subscription for an API. The API must exist in the API Portal and have subscription plans enabled. The subscription is owned by the authenticated user.

Payload

{
"artifactId": "weather-api-v1",
"subscriptionPlanId": "Gold"
}

Authentication​

This operation requires a Bearer JWT access token in the Authorization header. Required scopes (the token must carry at least one of): `dp:subscription:create`, `dp:subscription:manage`

Parameters​

NameInTypeRequiredDescription
bodybodySubscriptionCreateRequesttrueSubscription creation payload. artifactId is the API ID.

Example responses

201 Response

{
"subscriptionId": "sub-12345",
"artifactId": "weather-api-v1",
"subscriptionToken": "a3f1e8b2c4d6e8f0a1b3c5d7e9f10b2c4d6e8f0a1b3c5d7e9f10b2c4d6e8f0a1",
"subscriptionPlanName": "Gold",
"status": "ACTIVE",
"createdBy": "[email protected]",
"createdAt": "2026-05-07T08:30:00Z"
}

Bad request. Validation and other bad-request errors are returned as a standard error object (field-level details, when present, are carried in its errors array); some legacy handlers return a message-only object.

{
"status": "error",
"code": "MISSING_REQUIRED_PARAMETER",
"message": "Missing required parameter."
}
{
"message": "Missing or invalid fields in the request payload"
}

404 Response

{
"status": "error",
"code": "ORG_NOT_FOUND",
"message": "Organization not found."
}

409 Response

{
"status": "error",
"code": "CONFLICT",
"message": "Conflict"
}

500 Response

{
"status": "error",
"code": "INTERNAL_SERVER_ERROR",
"message": "An unexpected error occurred."
}

Responses​

StatusMeaningDescriptionSchema
201CreatedSubscription DTO.SubscriptionResponse
400Bad RequestBad request. Validation and other bad-request errors are returned as a standard error object (field-level details, when present, are carried in its errors array); some legacy handlers return a message-only object.Inline
404Not FoundResource not found.ErrorResponse
409ConflictThe request conflicts with an existing resource.ErrorResponse
500Internal Server ErrorInternal server error.ErrorResponse

Response schema​

Enumerated Values​

PropertyValue
statuserror

Response Headers​

StatusHeaderTypeFormatDescription
201LocationstringuriURL of the created subscription.

List subscriptions​

GET /subscriptions

Code samples


curl -X GET https://localhost:9543/api-portal/api/v0.9/subscriptions \
-H 'Authorization: Bearer {access_token}' \
-H 'Accept: application/json'

Lists subscriptions owned by the authenticated user. When artifactId is provided, results are additionally filtered by the API ID.

Authentication​

This operation requires a Bearer JWT access token in the Authorization header. Required scopes (the token must carry at least one of): `dp:subscription:read`, `dp:subscription:manage`

Parameters​

NameInTypeRequiredDescription
artifactIdquerystringfalseOptional API ID used to filter results.
limitqueryintegerfalseMaximum number of records to return.
offsetqueryintegerfalseNumber of records to skip before returning results.

Example responses

200 Response

{
"list": [
{
"subscriptionId": "sub-12345",
"artifactId": "weather-api-v1",
"subscriptionToken": "a3f1e8b2c4d6e8f0a1b3c5d7e9f10b2c4d6e8f0a1b3c5d7e9f10b2c4d6e8f0a1",
"subscriptionPlanName": "Gold",
"status": "ACTIVE",
"createdBy": "[email protected]",
"createdAt": "2026-05-07T08:30:00Z",
"updatedAt": "2026-05-07T08:30:00Z"
}
],
"count": 1,
"pagination": {
"total": 42,
"limit": 20,
"offset": 0
}
}

404 Response

{
"status": "error",
"code": "RESOURCE_NOT_FOUND",
"message": "API not found"
}

500 Response

{
"status": "error",
"code": "INTERNAL_SERVER_ERROR",
"message": "An unexpected error occurred."
}

Responses​

StatusMeaningDescriptionSchema
200OKList of subscription DTOs.Inline
404Not FoundReturned when artifactId is provided but does not match an existing API.ErrorResponse
500Internal Server ErrorInternal server error.ErrorResponse

Response schema​

Status Code 200

NameTypeRequiredRestrictionsDescription
» list[SubscriptionResponse]falsenone[Subscription payload.]
»» subscriptionIdstringfalsenonenone
»» artifactIdstringfalsenoneAPI ID.
»» subscriptionTokenstring¦nullfalsenonePlaintext subscription token, decrypted on every read (not just on create). Null if decryption fails (e.g. the encryption key changed since the token was stored).
»» subscriptionPlanNamestringfalsenonenone
»» statusstringfalsenonenone
»» createdBystringfalsenoneIdentity of the user who created the subscription, or deleted_user if that user's IDP reference no longer exists. Present on single-resource GET responses and list items.
»» updatedBystringfalsenoneIdentity of the user who last updated the subscription, or deleted_user if that user's IDP reference no longer exists. Present on single-resource GET responses only, omitted on list items.
»» createdAtstring(date-time)falsenonenone
»» updatedAtstring(date-time)falsenonenone
» countintegerfalsenoneNumber of items returned in this page.
» paginationPaginationfalsenoneStandard pagination metadata returned with collection responses.
»» totalintegertruenoneTotal number of records matching the query.
»» limitintegertruenoneMaximum number of records returned in this response.
»» offsetintegertruenoneNumber of records skipped before this page.

Enumerated Values​

PropertyValue
statusACTIVE
statusINACTIVE

Get a subscription​

GET /subscriptions/{subId}

Code samples


curl -X GET https://localhost:9543/api-portal/api/v0.9/subscriptions/{subId} \
-H 'Authorization: Bearer {access_token}' \
-H 'Accept: application/json'

Retrieves a single subscription by subscription ID.

Authentication​

This operation requires a Bearer JWT access token in the Authorization header. Required scopes (the token must carry at least one of): `dp:subscription:read`, `dp:subscription:manage`

Parameters​

NameInTypeRequiredDescription
subIdpathstringtruenone

Example responses

200 Response

{
"subscriptionId": "sub-12345",
"artifactId": "weather-api-v1",
"subscriptionToken": "a3f1e8b2c4d6e8f0a1b3c5d7e9f10b2c4d6e8f0a1b3c5d7e9f10b2c4d6e8f0a1",
"subscriptionPlanName": "Gold",
"status": "ACTIVE",
"createdBy": "[email protected]",
"updatedBy": "[email protected]",
"createdAt": "2026-05-07T08:30:00Z",
"updatedAt": "2026-05-07T08:30:00Z"
}

404 Response

{
"status": "error",
"code": "ORG_NOT_FOUND",
"message": "Organization not found."
}

500 Response

{
"status": "error",
"code": "INTERNAL_SERVER_ERROR",
"message": "An unexpected error occurred."
}

Responses​

StatusMeaningDescriptionSchema
200OKSubscription DTO.SubscriptionResponse
404Not FoundResource not found.ErrorResponse
500Internal Server ErrorInternal server error.ErrorResponse

Update a subscription​

PUT /subscriptions/{subId}

Code samples


curl -X PUT https://localhost:9543/api-portal/api/v0.9/subscriptions/{subId} \
-H 'Authorization: Bearer {access_token}' \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-d @payload.json

Updates the subscription status. Accepts only ACTIVE or INACTIVE.

Payload

{
"status": "ACTIVE"
}

Authentication​

This operation requires a Bearer JWT access token in the Authorization header. Required scopes (the token must carry at least one of): `dp:subscription:update`, `dp:subscription:manage`

Parameters​

NameInTypeRequiredDescription
bodybodySubscriptionUpdateRequesttrueSubscription status update payload.
subIdpathstringtruenone

Example responses

200 Response

{
"subscriptionId": "sub-12345",
"artifactId": "weather-api-v1",
"subscriptionToken": "a3f1e8b2c4d6e8f0a1b3c5d7e9f10b2c4d6e8f0a1b3c5d7e9f10b2c4d6e8f0a1",
"subscriptionPlanName": "Gold",
"status": "ACTIVE",
"createdBy": "[email protected]",
"updatedBy": "[email protected]",
"createdAt": "2026-05-07T08:30:00Z",
"updatedAt": "2026-05-07T08:30:00Z"
}

Bad request. Validation and other bad-request errors are returned as a standard error object (field-level details, when present, are carried in its errors array); some legacy handlers return a message-only object.

{
"status": "error",
"code": "MISSING_REQUIRED_PARAMETER",
"message": "Missing required parameter."
}
{
"message": "Missing or invalid fields in the request payload"
}

404 Response

{
"status": "error",
"code": "ORG_NOT_FOUND",
"message": "Organization not found."
}

500 Response

{
"status": "error",
"code": "INTERNAL_SERVER_ERROR",
"message": "An unexpected error occurred."
}

Responses​

StatusMeaningDescriptionSchema
200OKSubscription DTO.SubscriptionResponse
400Bad RequestBad request. Validation and other bad-request errors are returned as a standard error object (field-level details, when present, are carried in its errors array); some legacy handlers return a message-only object.Inline
404Not FoundResource not found.ErrorResponse
500Internal Server ErrorInternal server error.ErrorResponse

Response schema​

Enumerated Values​

PropertyValue
statuserror

Delete a subscription​

DELETE /subscriptions/{subId}

Code samples


curl -X DELETE https://localhost:9543/api-portal/api/v0.9/subscriptions/{subId} \
-H 'Authorization: Bearer {access_token}' \
-H 'Accept: application/json'

Deletes the subscription and returns a success message.

Authentication​

This operation requires a Bearer JWT access token in the Authorization header. Required scopes (the token must carry at least one of): `dp:subscription:delete`, `dp:subscription:manage`

Parameters​

NameInTypeRequiredDescription
subIdpathstringtruenone

Example responses

200 Response

{
"message": "string"
}

404 Response

{
"status": "error",
"code": "ORG_NOT_FOUND",
"message": "Organization not found."
}

500 Response

{
"status": "error",
"code": "INTERNAL_SERVER_ERROR",
"message": "An unexpected error occurred."
}

Responses​

StatusMeaningDescriptionSchema
200OKJSON message response.MessageResponse
404Not FoundResource not found.ErrorResponse
500Internal Server ErrorInternal server error.ErrorResponse

Change subscription plan​

POST /subscriptions/{subId}/change-plan

Code samples


curl -X POST https://localhost:9543/api-portal/api/v0.9/subscriptions/{subId}/change-plan \
-H 'Authorization: Bearer {access_token}' \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-d @payload.json

Changes the subscription plan in-place. The subscription UUID and token remain unchanged; only the plan is updated. A subscription.plan_changed webhook event is published to the organization's configured webhook subscribers.

Payload

{
"artifactId": "weather-api-v1",
"planId": "Gold"
}

Authentication​

This operation requires a Bearer JWT access token in the Authorization header. Required scopes (the token must carry at least one of): `dp:subscription:update`, `dp:subscription:manage`

Parameters​

NameInTypeRequiredDescription
bodybodySubscriptionChangePlanRequesttrueSubscription plan change payload. planId is the API Portal subscription plan ID.
subIdpathstringtruenone

Example responses

200 Response

{
"subscriptionId": "sub-12345",
"artifactId": "weather-api-v1",
"subscriptionToken": "a3f1e8b2c4d6e8f0a1b3c5d7e9f10b2c4d6e8f0a1b3c5d7e9f10b2c4d6e8f0a1",
"subscriptionPlanName": "Gold",
"status": "ACTIVE",
"createdBy": "[email protected]",
"updatedBy": "[email protected]",
"createdAt": "2026-05-07T08:30:00Z",
"updatedAt": "2026-05-07T08:30:00Z"
}

Bad request. Validation and other bad-request errors are returned as a standard error object (field-level details, when present, are carried in its errors array); some legacy handlers return a message-only object.

{
"status": "error",
"code": "MISSING_REQUIRED_PARAMETER",
"message": "Missing required parameter."
}
{
"message": "Missing or invalid fields in the request payload"
}

404 Response

{
"status": "error",
"code": "ORG_NOT_FOUND",
"message": "Organization not found."
}

500 Response

{
"status": "error",
"code": "INTERNAL_SERVER_ERROR",
"message": "An unexpected error occurred."
}

Responses​

StatusMeaningDescriptionSchema
200OKSubscription DTO.SubscriptionResponse
400Bad RequestBad request. Validation and other bad-request errors are returned as a standard error object (field-level details, when present, are carried in its errors array); some legacy handlers return a message-only object.Inline
404Not FoundResource not found.ErrorResponse
500Internal Server ErrorInternal server error.ErrorResponse

Response schema​

Enumerated Values​

PropertyValue
statuserror

Regenerate subscription token​

POST /subscriptions/{subId}/regenerate-token

Code samples


curl -X POST https://localhost:9543/api-portal/api/v0.9/subscriptions/{subId}/regenerate-token \
-H 'Authorization: Bearer {access_token}' \
-H 'Accept: application/json'

Regenerates the subscription token, immediately invalidating the old one. A subscription.token_regenerated webhook event is published to the organization's configured webhook subscribers so they can update the token at the gateway. The new plaintext token is returned in the response.

Authentication​

This operation requires a Bearer JWT access token in the Authorization header. Required scopes (the token must carry at least one of): `dp:subscription:manage`

Parameters​

NameInTypeRequiredDescription
subIdpathstringtruenone

Example responses

200 Response

{
"subscriptionId": "sub-12345",
"artifactId": "weather-api-v1",
"subscriptionToken": "a3f1e8b2c4d6e8f0a1b3c5d7e9f10b2c4d6e8f0a1b3c5d7e9f10b2c4d6e8f0a1",
"subscriptionPlanName": "Gold",
"status": "ACTIVE",
"createdBy": "[email protected]",
"updatedBy": "[email protected]",
"createdAt": "2026-05-07T08:30:00Z",
"updatedAt": "2026-05-07T08:30:00Z"
}

404 Response

{
"status": "error",
"code": "ORG_NOT_FOUND",
"message": "Organization not found."
}

500 Response

{
"status": "error",
"code": "INTERNAL_SERVER_ERROR",
"message": "An unexpected error occurred."
}

Responses​

StatusMeaningDescriptionSchema
200OKSubscription DTO.SubscriptionResponse
404Not FoundResource not found.ErrorResponse
500Internal Server ErrorInternal server error.ErrorResponse

Was this page helpful?