POST
/
get-subscription
Get subscription
curl --request POST \
  --url https://app.phonely.ai/api/get-subscription \
  --header 'Content-Type: application/json' \
  --data '{
  "subscriptionId": "<string>"
}'
{
  "message": "<string>",
  "subscription": {
    "subscriptionId": "<string>",
    "customerId": "<string>",
    "status": "<string>",
    "currentPeriodStart": 123,
    "currentPeriodEnd": 123
  }
}
Retrieves subscription details for a specific Stripe subscription.

Request

Method: POST
Endpoint: /api/get-subscription
Headers:
  • Content-Type: application/json
  • Origin: Must match the configured app URL
Request Body:
{
  "subscriptionId": "string"
}
Parameters:
  • subscriptionId (string, required): The Stripe subscription ID

Response

Success Response (200):
{
  "message": "Subscription retrieved.",
  "subscription": {
    "subscriptionId": "string",
    "customerId": "string",
    "status": "string",
    "currentPeriodStart": number,
    "currentPeriodEnd": number
  }
}
Error Responses:
  • 400 Bad Request: Subscription ID is required
  • 403 Forbidden: Unauthorized origin
  • 404 Not Found: Subscription not found
  • 500 Internal Server Error: Server error

Example

curl -X POST https://app.phonely.ai/api/get-subscription \
  -H "Content-Type: application/json" \
  -H "Origin: https://app.phonely.ai" \
  -d '{
    "subscriptionId": "sub_xxxxxxxxxxxxxxxxx"
  }'

Notes

  • This endpoint requires the request to come from the configured app URL
  • Returns key subscription information including status and billing periods
  • Only accessible from the official Phonely application

Body

application/json
subscriptionId
string
required

Stripe subscription ID

Response

Successful response

message
string

Response message

subscription
object