Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/paramveer-cyber/Deployaar/llms.txt

Use this file to discover all available pages before exploring further.

The prd router manages Product Requirements Documents — the structured specification that bridges a raw feature request and the coding agent’s work. After the clarification phase ends, the AI automatically drafts a PRD composed of seven sections. The user can edit individual sections and must explicitly approve the PRD before the agentRun.assignAllToCodingAgent procedure is allowed to run. Every procedure requires authentication.

prd.ensurePrdGeneration — mutation

Ensures a PRD exists and is being generated for the given feature request. If a PRD already exists and is sufficiently populated, this is a no-op and the response reflects that. If no PRD exists (or it has no content), the procedure triggers background AI generation and returns triggered: true.
Call this procedure after featureRequest.completeClarification to kick off PRD generation. Polling prd.getPrd afterward will show generation progress as sections fill in.

Input

featureRequestId
string (UUID)
required
The UUID of the feature request for which a PRD should be generated.

Response

{
  "success": true,
  "message": "OK",
  "data": {
    "triggered": true,
    "reason": "PRD generated successfully"
  }
}

prd.getPrd — query

Fetches the PRD associated with a feature request. Returns null if no PRD has been created yet. Once generated, all seven content sections are present as nullable strings — sections that haven’t been written yet will be null.

Input

featureRequestId
string (UUID)
required
The UUID of the feature request whose PRD should be fetched.

Response

{
  "success": true,
  "message": "Found",
  "data": {
    "prd": {
      "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
      "featureRequestId": "9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d",
      "problemStatement": "Finance team members cannot export report data, forcing manual copy-paste into spreadsheets. This costs approximately 2 hours per week per analyst.",
      "goals": "Provide a one-click CSV export of the currently filtered report data.",
      "nonGoals": "Real-time streaming exports, PDF exports, or scheduled email delivery are out of scope for this iteration.",
      "userStories": "As a finance analyst, I want to click an Export button on any report so that I can download the visible data as a CSV without leaving the application.",
      "acceptanceCriteria": "1. An 'Export CSV' button appears on the Reports page toolbar.\n2. Clicking it downloads a file named report_<date>.csv.\n3. The export respects the active date range filter.",
      "edgeCases": "Empty result sets produce a CSV with only the header row. Reports with more than 100,000 rows stream the response rather than buffering it in memory.",
      "successMetrics": "Zero support tickets about data export within 30 days of shipping.",
      "generatedAt": "2024-01-15T10:50:00.000Z",
      "approvedByUserId": null,
      "approvedAt": null,
      "createdAt": "2024-01-15T10:45:00.000Z",
      "updatedAt": "2024-01-15T10:50:00.000Z"
    }
  }
}
prd is null until ensurePrdGeneration has been called and the background AI job has finished writing content. Poll this endpoint every few seconds while generatedAt is null.

prd.updatePrd — mutation

Edits one or more content sections of an existing PRD. Only the provided fields are updated; omitted sections are left unchanged. The PRD must not yet be approved.

Input

prdId
string (UUID)
required
The UUID of the PRD to update.
featureRequestId
string (UUID)
required
The UUID of the feature request the PRD belongs to. Used for access control.
problemStatement
string
Updated problem statement section.
goals
string
Updated goals section.
nonGoals
string
Updated non-goals section.
userStories
string
Updated user stories section.
acceptanceCriteria
string
Updated acceptance criteria section.
edgeCases
string
Updated edge cases section.
successMetrics
string
Updated success metrics section.

Response

{
  "success": true,
  "message": "PRD updated",
  "data": {
    "prd": {
      "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
      "featureRequestId": "9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d",
      "problemStatement": "Updated problem statement text...",
      "goals": "Updated goals text...",
      "...": "..."
    }
  }
}

prd.approvePrd — mutation

Approves the PRD for the given feature request, recording the approving user and timestamp. After approval, the PRD can no longer be edited and the coding agent is unlocked — calling agentRun.assignAllToCodingAgent without a prior PRD approval returns a 400 Bad Request.
PRD approval is a prerequisite for triggering the coding agent. agentRun.assignAllToCodingAgent will throw 400 Bad Request if called before this procedure succeeds.

Input

featureRequestId
string (UUID)
required
The UUID of the feature request whose PRD should be approved.

Response

{
  "success": true,
  "message": "PRD approved",
  "data": {
    "prd": {
      "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
      "featureRequestId": "9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d",
      "approvedByUserId": "auth0|abc123",
      "approvedAt": "2024-01-15T11:30:00.000Z",
      "...": "..."
    }
  }
}

prd.getAllPrds — query

Returns a paginated list of all PRDs across every project the authenticated user can access. Useful for dashboard and reporting views. Each item includes denormalized project and feature request metadata.

Input

limit
number
Maximum number of PRDs to return. Minimum 1, maximum 100. Defaults to 50.
offset
number
Number of PRDs to skip for pagination. Minimum 0. Defaults to 0.

Response

{
  "success": true,
  "message": "Found",
  "data": {
    "prds": [
      {
        "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
        "featureRequestId": "9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d",
        "featureRequestTitle": "Add CSV export to the reports page",
        "featureRequestStatus": "in_development",
        "projectId": "1b9d6bcd-bbfd-4b2d-9b5d-ab8dfbbd4bed",
        "projectName": "Customer Portal",
        "generatedAt": "2024-01-15T10:50:00.000Z",
        "approvedAt": "2024-01-15T11:30:00.000Z",
        "approvedByUserId": "auth0|abc123",
        "createdAt": "2024-01-15T10:45:00.000Z",
        "updatedAt": "2024-01-15T11:30:00.000Z"
      }
    ]
  }
}

PRD approval gate diagram

The following describes the required order of operations before the coding agent can be triggered:
completeClarification()


ensurePrdGeneration()   ──►  [AI writes PRD sections in background]


   getPrd()  ◄── poll until generatedAt is not null


   updatePrd()   (optional — user edits)


   approvePrd()   ──►  approvedAt is set


assignAllToCodingAgent()   ──►  coding agent runs

TypeScript example

import { trpc } from "~/trpc/client";

const featureRequestId = "9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d";

// Step 1 – trigger PRD generation after clarification is complete
const ensureMutation = trpc.prd.ensurePrdGeneration.useMutation();
await ensureMutation.mutateAsync({ featureRequestId });

// Step 2 – poll until the PRD is fully generated
const { data, refetch } = trpc.prd.getPrd.useQuery(
  { featureRequestId },
  { refetchInterval: (query) =>
      query.state.data?.data.prd?.generatedAt == null ? 3000 : false },
);

// Step 3 – optionally edit a section
const updateMutation = trpc.prd.updatePrd.useMutation();
await updateMutation.mutateAsync({
  prdId: data!.data.prd!.id,
  featureRequestId,
  acceptanceCriteria:
    "1. Export button visible on Reports page.\n" +
    "2. File named report_<YYYY-MM-DD>.csv.\n" +
    "3. Respects active date range filter.",
});

// Step 4 – approve the PRD to unlock the coding agent
const approveMutation = trpc.prd.approvePrd.useMutation();
await approveMutation.mutateAsync({ featureRequestId });

REST equivalent (curl)

# Ensure PRD generation is triggered
curl -X POST https://api.deployaar.com/api/feature-requests/{featureRequestId}/prd/ensure-generation \
  -H "Authorization: Bearer <token>"

# Get the PRD for a feature request
curl https://api.deployaar.com/api/feature-requests/{featureRequestId}/prd \
  -H "Authorization: Bearer <token>"

# Update PRD sections
curl -X PATCH https://api.deployaar.com/api/feature-requests/{featureRequestId}/prd/{prdId} \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d '{"acceptanceCriteria": "1. Export button visible.\n2. Downloads as CSV."}'

# Approve the PRD
curl -X POST https://api.deployaar.com/api/feature-requests/{featureRequestId}/prd/approve \
  -H "Authorization: Bearer <token>"

# List all PRDs (paginated)
curl "https://api.deployaar.com/api/prds?limit=20&offset=0" \
  -H "Authorization: Bearer <token>"

Build docs developers (and LLMs) love