Skip to main content

GET /api/subscription

Retrieves the subscription details for the authenticated user, including plan information, status, billing period, and plan limits.

Authentication

This endpoint requires authentication. Include your access token in the request cookies.

Response

plan
string
required
Current plan name. Options: FREE, BASIC, PRO, ENTERPRISE
status
string
required
Subscription status. Options: ACTIVE, CANCELLED, EXPIRED, PAST_DUE, UNPAID, TRIALING
planPrice
number
required
Monthly price of the plan in the currency (e.g., MXN)
currentPeriodStart
string
Start date of the current billing period (ISO 8601 format). Null for FREE plan
currentPeriodEnd
string
End date of the current billing period (ISO 8601 format). Null for FREE plan
cancelAtPeriodEnd
boolean
required
Whether the subscription will be cancelled at the end of the current period
stripeCustomerId
string
Stripe customer ID. Null for FREE plan
stripeSubscriptionId
string
Stripe subscription ID. Null for FREE plan
limits
object
required
Plan limits and features

Example Request

curl -X GET "https://api.contafy.com/api/subscription" \
  -H "Cookie: access_token=your_access_token"

Example Response

{
  "plan": "PRO",
  "status": "ACTIVE",
  "planPrice": 599,
  "currentPeriodStart": "2024-03-01T00:00:00Z",
  "currentPeriodEnd": "2024-04-01T00:00:00Z",
  "cancelAtPeriodEnd": false,
  "stripeCustomerId": "cus_123456789",
  "stripeSubscriptionId": "sub_987654321",
  "limits": {
    "profiles": null,
    "invoicesPerMonth": null,
    "expensesPerMonth": null,
    "exportPDF": true,
    "exportExcel": true,
    "reports": "advanced",
    "support": "priority",
    "apiAccess": true,
    "satBasicSearchesPerMonth": null,
    "satAISearchesPerMonth": 500,
    "satMaxResults": null,
    "satHasAIExplanations": true,
    "satHasHistory": true,
    "satHasFavorites": true,
    "satHasAlerts": true
  }
}

Error Responses

401 Unauthorized
error
Authentication required or token expired
{
  "error": "Unauthorized",
  "message": "Authentication required"
}
500 Internal Server Error
error
Server error occurred
{
  "error": "Internal Server Error",
  "message": "An unexpected error occurred"
}