Skip to content
163 changes: 163 additions & 0 deletions api-reference/openapi/upload.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,163 @@
{
"openapi": "3.1.0",
"info": {
"title": "Recoup API - Upload",
"description": "API documentation for the Recoup platform - an AI agent platform for the music industry",
"license": {
"name": "MIT"
},
"version": "1.0.0"
},
"security": [
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2: Custom agent: Documentation and Naming Conventions for Maintainable Code

Removed the explicit servers array from the OpenAPI spec, breaking documentation clarity and consistency with other API specs.

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

<comment>Removed the explicit `servers` array from the OpenAPI spec, breaking documentation clarity and consistency with other API specs.</comment>

<file context>
@@ -8,11 +8,6 @@
-      "url": "https://recoup-api.vercel.app"
-    }
-  ],
   "security": [
     { "bearerAuth": [] },
     { "apiKeyAuth": [] }
</file context>

{ "apiKeyAuth": [] },
{ "bearerAuth": [] }
],
"paths": {
"/api/upload": {
"post": {
"description": "Uploads a file and returns a permanent CDN-fronted HTTPS URL. Accepts a single file via multipart/form-data under the field name `file`. The caller's accountId is stamped onto the storage object's metadata as `uploaded_by` for audit purposes.",
"requestBody": {
"required": true,
"content": {
"multipart/form-data": {
"schema": {
"type": "object",
"required": ["file"],
"properties": {
"file": {
"type": "string",
"format": "binary",
"description": "The file bytes to upload. The file's Content-Type must be on the server allowlist (image/*, application/pdf, text/csv, text/markdown, text/plain, application/json, audio/mpeg, audio/wav, audio/x-m4a, audio/webm). Typeless / octet-stream uploads are rejected."
}
}
}
}
}
},
"responses": {
"200": {
"description": "File uploaded successfully",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/UploadResponse"
}
}
}
},
"400": {
"description": "Bad request — multipart body could not be parsed or no `file` field was provided.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/UploadErrorResponse"
}
}
}
},
"401": {
"description": "Missing or invalid authentication. Provide either an `Authorization: Bearer <token>` header or `x-api-key`.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/UploadErrorResponse"
}
}
}
},
"415": {
"description": "Unsupported file type — the file's Content-Type is not on the server allowlist or is empty / `application/octet-stream`.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/UploadErrorResponse"
}
}
}
},
"500": {
Comment thread
cubic-dev-ai[bot] marked this conversation as resolved.
"description": "Internal storage error. Full details are logged server-side.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/UploadErrorResponse"
}
}
}
}
}
}
}
},
"components": {
"securitySchemes": {
"apiKeyAuth": {
"type": "apiKey",
"in": "header",
"name": "x-api-key"
},
"bearerAuth": {
"type": "http",
"scheme": "bearer"
}
},
"schemas": {
"UploadResponse": {
"type": "object",
"required": [
"success",
"fileName",
"fileType",
"fileSize",
"url"
],
"properties": {
"success": {
"type": "boolean",
"description": "Always `true` on a 200 response.",
"example": true
},
"fileName": {
"type": "string",
"description": "The original file name from the upload.",
"example": "cover.png"
},
"fileType": {
"type": "string",
"description": "The MIME type of the uploaded file, exactly as provided by the client. Must be on the server allowlist.",
"example": "image/png"
},
"fileSize": {
"type": "integer",
"description": "The size of the uploaded file in bytes.",
"example": 24576
},
"url": {
"type": "string",
"description": "Permanent fetchable HTTPS URL for the uploaded file.",
"example": "https://example.supabase.co/storage/v1/object/public/public-uploads/abc123.png"
}
}
},
"UploadErrorResponse": {
"type": "object",
"required": [
"success",
"error"
],
"properties": {
"success": {
"type": "boolean",
"description": "Always `false` on an error response.",
"example": false
},
"error": {
"type": "string",
"description": "Human-readable error message. For 500 errors this is intentionally generic; full details are logged server-side.",
"example": "No file provided"
}
}
}
}
}
}
4 changes: 4 additions & 0 deletions api-reference/upload/file.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
title: 'Upload File'
openapi: '/api-reference/openapi/upload.json POST /api/upload'
Comment on lines +2 to +3
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Fix API-reference frontmatter metadata/format on Line 2 and Line 3.

This page is missing description, and openapi is not in the required METHOD /path format.

Proposed fix
 ---
 title: 'Upload File'
-openapi: '/api-reference/openapi/upload.json POST /api/upload'
+description: 'Upload a file and receive a permanent CDN URL.'
+openapi: 'POST /api/upload'
 ---
As per coding guidelines, "`**/*.mdx`: Use MDX ... with frontmatter for page metadata (title, description)" and "`api-reference/**/*.mdx`: ... Include OpenAPI spec reference ... format: openapi: 'METHOD /path'".
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
title: 'Upload File'
openapi: '/api-reference/openapi/upload.json POST /api/upload'
---
title: 'Upload File'
description: 'Upload a file and receive a permanent CDN URL.'
openapi: 'POST /api/upload'
---
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@api-reference/upload/file.mdx` around lines 2 - 3, Update the MDX frontmatter
to include a description key and fix the openapi field format: add a descriptive
description (e.g., "Upload a file to the server") and replace the current
openapi value with the required METHOD /path string (for example set openapi:
'POST /api/upload'); ensure the frontmatter still includes the title and the
corrected openapi and description entries so the page follows the api-reference
frontmatter conventions.

---
6 changes: 6 additions & 0 deletions docs.json
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,12 @@
"api-reference/posts/get",
"api-reference/comments/get"
]
},
{
"group": "Upload",
"pages": [
"api-reference/upload/file"
]
}
]
},
Expand Down