The Miniapp Studio API is an allowlisted API and not publicly available. Contact the Neynar team for more information.
Prerequisites
- An allowlisted Neynar API key
- Your Farcaster ID (FID)
API Endpoints Overview
The Miniapp Studio API provides the following endpoints for managing deployments:- Create Deployment:
POST /v2/studio/deployment/
- Create a new miniapp generator deployment - Get Deployment:
GET /v2/studio/deployment/by-name-and-fid
- Fetch deployment details - List Deployments:
GET /v2/studio/deployment/
- List all deployments for a user - Prompt Deployment:
POST /v2/studio/deployment/prompt
- Send a prompt to generate code - Stream Prompt:
POST /v2/studio/deployment/prompt/stream
- Send a prompt and stream AI responses in real-time - Associate Account:
POST /v2/studio/deployment/account-association
- Link a generated app to Farcaster account - Delete Deployment:
DELETE /v2/studio/deployment/
- Remove deployments
Step 1: Create a Deployment
Start by creating a new deployment for your Farcaster account using the Create Deployment endpoint:Save the
name
field from the response - you’ll need it to interact with this deployment.Step 2: Check Deployment Readiness
After creating a deployment, it may take up to a minute to become ready. You should poll the Get Deployment endpoint untilisReady
is true
:
Step 3: Prompt the Deployment for Code Generation
Once your deployment showsisReady: true
, you can send prompts to generate miniapp code. Since generation can take 5-10 minutes, the streaming option is recommended for better user experience.
Option A: Streaming Prompt (Recommended)
The Stream Prompt endpoint provides real-time progress updates using Server-Sent Events (SSE):SDKAssistantMessage
: Claude’s responses during generationSDKUserMessage
: User prompts being processedSDKResultMessage
: Final results (success/error)SDKSystemMessage
: System initialization messagesErrorMessage
: Any errors during generation
@anthropic-ai/claude-code
npm package except the ErrorMessage
type, which simply consists of type: "error"
, an error message, and a timestamp.
Option B: Standard REST API (Wait for Complete Response)
The Prompt Deployment endpoint will wait until generation is complete before returning a response:This endpoint will wait 5-10 minutes until generation completes before returning a response. Use the streaming endpoint for real-time progress updates.
Action Types for Prompt Operations
Both prompt endpoints support an optionalaction
parameter that specifies the type of operation to perform on your deployment:
code-create
(default): Generate new code for a fresh project. Use this when starting a new miniapp from scratch.code-edit
: Make edits to an existing project that has already been prompted at least once. Use this for modifying or adding features to your miniapp.debug
: Debug issues with your generated miniapp. The AI will analyze your code and help identify and fix problems.info
: Get information about your generated miniapp.logs
: Query the latest server logs for further debugging. This helps you understand runtime issues and errors for manual debugging.
Step 4: Associate Deployment with Account
Link your deployment to your Farcaster account with JFS using the Associate Account endpoint:The JFS (JSON Farcaster Signature) object is required for domain association. This verifies that you own both the Farcaster account and the domain.
Additional API Actions
Beyond the core deployment workflow, you can use these endpoints to manage your deployments:List All Deployments
View all deployments associated with your FID using the List Deployments endpoint:Clean Up Deployments
You can delete deployments in two ways using the Delete Deployment endpoint:Delete a Specific Deployment
Delete All Deployments for Your FID
Deleting all deployments will remove every deployment associated with your FID. This action cannot be undone.
Best Practices
- Always save deployment names: Store the deployment name from the creation response to interact with it later
- Use streaming for long operations: The streaming endpoint provides better user experience for prompt operations
- Clean up unused deployments: Regularly delete deployments you’re no longer using to keep your account organized
Troubleshooting
Deployment Not Ready
IfisReady
is false, wait a few moments before trying to prompt the deployment. New deployments need time to initialize.
Streaming Connection Issues
For streaming endpoints, ensure your HTTP client supports Server-Sent Events (SSE). Most modern libraries and tools support this natively.Next Steps
- Explore the Mini App Authentication to add user sign-in to your generated miniapps
- Learn about Sending Notifications to engage users
- Check out the Neynar Starter Kit for building miniapps from templates