Capsules API
The Capsules API allows you to create, retrieve, and manage AI-generated content capsules. These capsules are dynamic, intelligent documents that can be regenerated with updated prompts or integrated with other processed documents.
API Endpoints
Create a new capsule
/capsules Create a new content capsule. You can optionally provide a name and slug for the capsule. If slug is not provided, it will be auto-generated from the name.
curl -X POST https://api.shrinked.com/capsules \ -H "x-api-key: YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "name": "Bioengineering Lecture Summary", "slug": "bioengineering-lecture-summary" }'{ "id": "capsule123456", "name": "Bioengineering Lecture Summary", "slug": "bioengineering-lecture-summary", "createdAt": "2023-05-10T15:30:00Z", "updatedAt": "2023-05-10T15:30:00Z"}Get a single capsule by ID
/capsules/ID Retrieve a specific content capsule by its ID.
curl -X GET https://api.shrinked.com/capsules/capsule123456 \ -H "x-api-key: YOUR_API_KEY"{ "id": "capsule123456", "name": "Bioengineering Lecture Summary", "slug": "bioengineering-lecture-summary", "content": "This is the AI-generated summary of the bioengineering lecture...", "files": [ { "id": "file789012", "name": "lecture-notes.pdf" } ], "createdAt": "2023-05-10T15:30:00Z", "updatedAt": "2023-05-10T15:35:00Z"}Regenerate capsule by ID
/capsules/ID/regenerate Regenerate the content of a specific capsule by its ID. You can optionally provide an overridePrompt as a query parameter to guide the regeneration.
The overridePrompt parameter allows you to provide a detailed set of instructions to the AI model, overriding the default prompt for the capsule. This is useful for generating content with a specific format, persona, or set of constraints.
Here is an example of a detailed overridePrompt:
You are David Martinez, a certified home inspector with 18 years of experience creating clear, actionable reports.
Source Material:|<context_buffer> {{fullContext}} </context_buffer>
CRITICAL: Every finding must be tied to exact timestamps. ONLY include explicit information. Aggregate facts across all provided inspection sources to identify cross-inspection patterns. *Scale output length beyond 1000 words when more context data is available.*
Create an inspection report with:
**Critical Finding**Open with the most impactful safety or financial finding from the inspected properties or data (with timestamps).
**Executive Summary & Risk Assessment**Overall condition, safety concerns, and limitations (with timestamps).
**Immediate Action Required**- [timestamp] Safety hazard or code violationIf none, state “No immediate concerns.”
**Major Systems Assessment**Focus on significant findings (with timestamps):- Structural & Foundation- Electrical System- Plumbing System- HVAC System- Roofing & ExteriorNote limitations concisely.
**Economic Impact Analysis**- Immediate Repairs (0–30 days)- Short-term Maintenance (1–12 months)- Long-term Considerations (1–5 years)Cite timestamps.
**Comprehensive Findings**Detailed observations by severity (with timestamps).
**Ongoing Maintenance Strategy**Preventive recommendations (with timestamps).
**Property Viability**Synthesize the overall condition and patterns across inspected properties or data, with implications for buyers (with timestamps).
Focus on observed findings, weaving timestamps naturally. Target *1000–1500 words, expanding with additional context data*.When using the overridePrompt in a curl request, make sure to URL-encode the prompt string.
Retrieve all capsules owned by the current user
/capsules Retrieve a list of all content capsules owned by the authenticated user.
curl -X GET https://api.shrinked.com/capsules \ -H "x-api-key: YOUR_API_KEY"[ { "id": "capsule123456", "name": "Bioengineering Lecture Summary", "slug": "bioengineering-lecture-summary", "createdAt": "2023-05-10T15:30:00Z" }, { "id": "capsule789012", "name": "Project Alpha Overview", "slug": "project-alpha-overview", "createdAt": "2023-05-09T10:00:00Z" }]Add a document (processed doc) to a capsule
/capsules/ID/files Add one or more processed documents to an existing capsule.
curl -X POST https://api.shrinked.com/capsules/capsule123456/files \ -H "x-api-key: YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "fileIds": ["file789012", "file345678"] }'{ "id": "capsule123456", "message": "Documents added to capsule successfully."}Remove a document from a capsule
/capsules/ID/files/FILE_ID Remove a specific document from a capsule.
curl -X DELETE https://api.shrinked.com/capsules/capsule123456/files/file789012 \ -H "x-api-key: YOUR_API_KEY"{ "id": "capsule123456", "message": "Document removed from capsule successfully."}Search within capsules
/capsules/search Search for content within all capsules owned by the current user.
curl -X GET "https://api.shrinked.com/capsules/search?query=bioengineering" \ -H "x-api-key: YOUR_API_KEY"[ { "id": "capsule123456", "name": "Bioengineering Lecture Summary", "excerpt": "This is an excerpt from the bioengineering lecture summary...", "matchedFiles": ["file789012"] }]