Skip to content

Get Subscription

Get user subscription details.

Endpoint

http
GET /api/subscriptions/detail

Request example

sh
curl --location --request GET 'https://files.ro/api/subscriptions/detail' \
--header 'Authorization: Bearer {token}'

Response

json
{
  "data": {
    "id": "sub_123",
    "type": "subscription",
    "attributes": {
      "is_cancelled": false,
      "driver": "stripe",
      "name": "default",
      "status": "active",
      "trial_ends_at": null,
      "updated_at": "01. Jan. 2024",
      "created_at": "01. Jan. 2024",
      "renews_at": "29. Jan. 2024",
      "ends_at": null
    },
    "relationships": {
      "plan": {
        "data": {
          "id": "plan_123",
          "type": "plans",
          "attributes": {
            "name": "Pro",
            "status": "active",
            "type": "metered",
            "visible": true,
            "currency": "USD",
            "interval": "monthly",
            "description": "Pro plan",
            "subscribers": 12,
            "features": {
              "storage": {
                "aggregate_strategy": "sum",
                "tiers": [
                  {
                    "up_to": 1000,
                    "unit_amount": 100
                  }
                ]
              }
            },
            "created_at": "01. Jan. 2024",
            "updated_at": "01. Jan. 2024"
          },
          "meta": {
            "driver_plan_id": {
              "stripe": "plan_abc"
            }
          }
        }
      },
      "user": {
        "data": {
          "id": "user_123",
          "type": "users",
          "attributes": {
            "avatar": "https://files.ro/storage/avatars/jane.png",
            "name": "Jane Doe",
            "first_name": "Jane",
            "last_name": "Doe",
            "color": "#00BC7E",
            "email": "jane@example.com"
          }
        }
      }
    }
  }
}
json
{
  "type": "error",
  "message": "User do not have subscription"
}