Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions api-reference/billing/credits.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
title: 'Get Credits'
openapi: '/api-reference/openapi/billing.json GET /api/credits'
---
4 changes: 4 additions & 0 deletions api-reference/billing/subscription-status.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
title: 'Subscription Status'
openapi: '/api-reference/openapi/billing.json GET /api/subscription'
---
192 changes: 192 additions & 0 deletions api-reference/openapi/billing.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,192 @@
{
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P3: Custom agent: Enforce Clear Code Style and Maintainability Practices

New file exceeds the 100-line file limit required by Rule 2.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At api-reference/openapi/billing.json, line 1:

<comment>New file exceeds the 100-line file limit required by Rule 2.</comment>

<file context>
@@ -0,0 +1,166 @@
+{
+  "openapi": "3.1.0",
+  "info": {
</file context>

"openapi": "3.1.0",
"info": {
"title": "Recoup API - Billing",
"description": "API documentation for the Recoup platform - an AI agent platform for the music industry",
"license": {
"name": "MIT"
},
"version": "1.0.0"
},
"servers": [
{
"url": "https://recoup-api.vercel.app"
}
],
"paths": {
"/api/credits": {
"get": {
"description": "Returns the credit balance for the authenticated account, automatically resetting the balance when the account is on a refill cycle (monthly cadence or just-activated subscription). Honors both account-level and organization-level Stripe subscriptions when deciding whether the refill should use the pro tier.",
"security": [
{
"apiKeyAuth": []
},
{
"bearerAuth": []
}
],
"responses": {
"200": {
"description": "Credits retrieved (and refilled if eligible).",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/CreditsGetResponse"
}
}
}
},
"401": {
"description": "Authentication required or invalid.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/BillingErrorResponse"
}
}
}
},
"500": {
"description": "Internal server error.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/BillingErrorResponse"
}
}
}
}
}
}
},
"/api/subscription": {
"get": {
"description": "Returns whether the authenticated account is on a pro subscription. An account is considered pro if it has an active Stripe subscription itself, or if any of its organizations does.",
"security": [
{
"apiKeyAuth": []
},
{
"bearerAuth": []
}
],
"responses": {
"200": {
"description": "Pro status retrieved.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/SubscriptionStatusResponse"
}
}
}
},
"401": {
"description": "Authentication required or invalid.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/BillingErrorResponse"
}
}
}
},
"500": {
"description": "Internal server error.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/BillingErrorResponse"
}
}
}
}
}
}
}
},
"components": {
"securitySchemes": {
"bearerAuth": {
"type": "http",
"scheme": "bearer"
},
"apiKeyAuth": {
"type": "apiKey",
"in": "header",
"name": "x-api-key",
"description": "Your Recoup API key. [Learn more](/quickstart#api-keys)."
}
},
"schemas": {
"CreditsGetResponse": {
"type": "object",
"required": [
"data"
],
"properties": {
"data": {
"oneOf": [
{
"$ref": "#/components/schemas/CreditsUsage"
},
{
"type": "null"
}
],
"description": "The authenticated account's credits usage row, or null when the account has no credits row yet."
}
}
},
"CreditsUsage": {
"type": "object",
"required": [
"account_id",
"remaining_credits"
],
"properties": {
"account_id": {
"type": "string",
"description": "The Recoup account ID."
},
"remaining_credits": {
"type": "number",
"description": "Remaining credits for the account."
},
"timestamp": {
"type": [
"string",
"null"
],
"format": "date-time",
"description": "ISO timestamp of the last credits refill."
}
}
},
"SubscriptionStatusResponse": {
"type": "object",
"required": [
"isPro"
],
"properties": {
"isPro": {
"type": "boolean",
"description": "True when the account or any of its organizations has an active Stripe subscription."
}
}
},
"BillingErrorResponse": {
"type": "object",
"required": [
"message"
],
"properties": {
"message": {
"type": "string",
"description": "Human-readable error message."
}
}
}
}
}
}
7 changes: 7 additions & 0 deletions docs.json
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,13 @@
"api-reference/subscriptions/sessions-create"
]
},
{
"group": "Billing",
"pages": [
"api-reference/billing/credits",
"api-reference/billing/subscription-status"
]
},
{
"group": "Admins",
"pages": [
Expand Down