Skip to content

Verament endpoints

83 endpoints at https://api.vaif.studio, generated from the API's OpenAPI document. The REST API page covers authentication, and All endpoints lists every group.

POST /ai/copilot/chat

Request body (application/json, required)
{
  projectId: string (uuid);
  sessionId?: string (uuid);
  message: string;
  attachments?: {
    type: "schema" | "function" | "file" | "context";
    name?: string;
    content: string;
  }[];
  generationTypes?: ("schema" | "storage" | "functions" | "backend" | "fullstack")[];
  generationOptions?: {
    scope?: "auto" | "database" | "database-api" | "backend" | "single-piece";
    outputDepth?: "prototype" | "standard" | "production";
    sampleData?: "off" | "few" | "realistic";
    tests?: boolean;
    auth?: "none" | "sign-in" | "roles";
    multiTenant?: boolean;
    rowRules?: "owner" | "org" | "public-read";
    fileStorage?: boolean;
    realtime?: boolean;
    events?: boolean;
    clientSnippets?: boolean;
  };
  existingProjectMode?: "extend" | "separate";
  modelId?: string;
  tier?: string;
  effort?: string;
  stream?: boolean;
  pinnedContext?: {
    tableIds?: string[];
    functionIds?: string[];
    bucketIds?: string[];
  };
  preflight?: {
    contextDrops?: string[];
    creditChoice?: "smaller" | "until_zero" | "stop";
    confirmPlanId?: string (uuid);
    assumptionChoices?: {
      [key: string]: string;
    };
    planWithDefaults?: boolean;
    docs?: {
      kinds: ("api" | "guide" | "architecture" | "custom")[];
      note?: string;
    };
    cancelPlanId?: string (uuid);
    scopeAnswer?: {
      decisionId?: string (uuid);
      scope: "database" | "database-api" | "backend" | "single-piece";
    };
  };
  autoConfirm?: {
    maxCredits: number;
  };
  brainstorm?: {
    stepId?: string (uuid);
    optionId?: "o1" | "o2" | "o3" | "o4";
    proposeNow?: true;
    planApproachId?: "a1" | "a2" | "a3";
    confirmMaxCredits?: number;
  };
  intent?: "explain";
}
Response 200 (application/json)
{
  ok: boolean;
  sessionId: any;
  messageId: any;
  response: {
    type: string;
    content: string;
  };
  context: any;
  preflightRequired: {
    kind: string;
    plan: {
      planId: string;
      expiresAt: string;
      scope: null | {
        scope: string;
        auto: boolean;
        clear: boolean;
      };
      files: {
        path: string;
        description: string;
      }[];
      fileCount: number;
      batchCount: number;
      planningCredits: number;
      maximumCredits: null | number;
      remainingCredits: null | number;
      credits: null | {
        scope: any;
        maximumCredits: number;
        remainingCredits: number;
        upgradePlan: any;
        smallerRun: any;
        untilZero: any;
      };
      autoConfirm?: {
        maxCredits: number;
        refused: true;
      };
      scopeDecisionId?: string;
      unmetered: boolean;
      engine: null | {
        tier: any;
        tierLabel: string;
        effort: any;
        effortLabel: string;
      };
      assumptions: {
        id: string;
        topic: any;
        text: string;
        choice: string;
        options: any[];
      }[];
      provided: {
        path: string;
        reason: string;
      }[];
      docs: null | {
        defaultChoice: "readme";
        kinds: any[];
        noteMax: number;
        maximumCredits: any;
        selections: any[];
      };
    };
  };
}

Errors: 400, 401, 402, 403, 404, 409, 410, 413, 422, 429, 500, 502, 503, with the error body.

POST /ai/copilot/chat/stream

Response 200 (text/event-stream)
string

POST /ai/copilot/generation/resume

Response 200

No body.

GET /ai/copilot/manifest/{manifestId}

ParameterInTypeRequired
manifestIdpathstringYes
projectIdquerystringNo
Response 200 (application/json)
{
  manifest: {
    generationScope?: {
      scope: "backend" | "database" | "database-api" | "single-piece";
      auto: boolean;
      clear?: boolean;
    };
    id: string;
    sessionId: string;
    projectId: string;
    originalPrompt: string;
    runTurns?: string[];
    provided?: {
      path: string;
      reason: string;
    }[];
    docs?: {
      suggested: any[];
      maximumCredits: null | { [key: string]: any };
      selections?: any[];
    };
    typecheckFailures?: {
      path: string;
      code: string;
      hash: string;
    }[];
    env?: {
      name: string;
      purpose: string;
    }[];
    assumptions?: {
      id: string;
      topic: any;
      text: string;
      choice: string;
      options: any[];
    }[];
    generationType: "backend" | "fullstack" | "functions" | "schema" | "storage";
    status: "completed" | "failed" | "generating" | "paused" | "pending" | "repairing" | "verifying";
    project: {
      name: string;
      description: string;
      stack: {
        language: string;
        framework: string;
        database: string;
      };
      architecture: string;
      folderStructure: string;
    };
    files: {
      id: string;
      path: string;
      type: "config" | "controller" | "docs" | "function" | "middleware" | "route" | "schema" | "service" | "test" | "type";
      description: string;
      language: string;
      estimatedTokens: number;
      priority: number;
      dependsOn: string[];
      status: "completed" | "failed" | "generating" | "pending" | "queued";
      batchNumber?: number;
      content?: string;
      actualTokens?: number;
      error?: string;
    }[];
    fileGroups: {
      id: string;
      name: string;
      icon: string;
      fileIds: string[];
      order: number;
    }[];
    batches: {
      number: number;
      fileIds: string[];
      wave?: number;
      settled?: boolean;
      status: "completed" | "failed" | "in_progress" | "pending";
      estimatedTokens: number;
      actualTokens?: number;
      startedAt?: string (date-time);
      completedAt?: string (date-time);
      error?: string;
    }[];
    estimates: {
      totalFiles: number;
      totalTokens: number;
      estimatedCredits: number;
      totalBatches: number;
      estimatedDurationSeconds?: number;
      creditsPer1kTokens?: number;
    };
    generationEffort?: "balanced" | "deep" | "extended" | "quick";
    totalEstimatedTokens: number;
    totalActualTokens?: number;
    estimatedCredits: number;
    actualCredits?: number;
    truncatedByProvider?: {
      [key: string]: boolean;
    };
    createdAt: string (date-time);
    updatedAt: string (date-time);
    startedAt?: string (date-time);
    completedAt?: string (date-time);
  };
  checkpoint: null | {
    id: string;
    resumeToken: string;
    expiresAt: string (date-time);
    currentBatch: number;
    completedFiles: number;
  };
  progress: {
    totalFiles: number;
    completedFiles: number;
    failedFiles: number;
    currentBatch: number;
    totalBatches: number;
  };
}

POST /ai/copilot/manifest/{manifestId}/pause

ParameterInTypeRequired
manifestIdpathstringYes
Request body (application/json)
{
  projectId?: string;
}
Response 200 (application/json)
{
  ok: boolean;
  checkpoint: {
    id: string;
    resumeToken: string;
    expiresAt: string (date-time);
  };
}

POST /ai/copilot/generation/{manifestId}/cancel

ParameterInTypeRequired
manifestIdpathstringYes
Request body (application/json)
{
  projectId?: string;
  savePartial?: boolean;
}
Response 200 (application/json)
{
  ok: boolean;
  cancelled: boolean;
  savedPartial: boolean;
  completedFiles: {
    id: string;
    path: string;
    content?: string;
  }[];
  checkpoint?: {
    id: string;
    resumeToken: string;
    expiresAt: string (date-time);
  };
}

GET /ai/copilot/credit-status/{projectId}

ParameterInTypeRequired
projectIdpathstring (uuid)Yes
Response 200 (application/json)
{
  creditsPer1kTokens: null | number;
  totalCreditsUsed: number;
  creditLimit: number;
  percentUsed: number;
  remaining: number;
  status: string;
  paused: boolean;
  notifyAtPercent: number;
  autoTopUp: null | {
    enabled: boolean;
    packageId: string;
    monthlyCapUsd: number;
    chargedThisPeriodCents: number;
    lastStatus: null | string;
    lastTopUpAt: null | string;
    lastTopUpAmountCents: null | number;
    lastTopUpCredits: null | number;
  };
  premiumMultiplier: number;
  unmetered: boolean;
  copilotCreditsUsed: number;
  plan: "agency" | "enterprise" | "entry" | "entry_plus" | "free" | "pro" | "starter" | "studio_plus";
  tier: "agency" | "enterprise" | "entry" | "entry_plus" | "free" | "pro" | "starter" | "studio_plus";
  periodEnd: string;
  daysRemaining: number;
}

GET /ai/copilot/context-summary/{projectId}

ParameterInTypeRequired
projectIdpathstring (uuid)Yes
Response 200 (application/json)
{
  tables: {
    id: string;
    name: string;
    columnCount: number;
  }[];
  functions: {
    id: string;
    name: string;
    schedule: null | string;
    enabled: boolean;
  }[];
  buckets: {
    id: string;
    name: string;
    isPublic: boolean;
  }[];
  memories: {
    id: string;
    type: string;
    content: string;
    importance: string;
    scope: string;
  }[];
  tokenUsage: {
    used: number;
    max: number;
  };
}

POST /ai/copilot/sessions

Request body (application/json, required)
{
  projectId: string (uuid);
  title?: string;
  generationTypes?: string[];
  generationOptions?: {
    scope?: "auto" | "database" | "database-api" | "backend" | "single-piece";
    outputDepth?: "prototype" | "standard" | "production";
    sampleData?: "off" | "few" | "realistic";
    tests?: boolean;
    auth?: "none" | "sign-in" | "roles";
    multiTenant?: boolean;
    rowRules?: "owner" | "org" | "public-read";
    fileStorage?: boolean;
    realtime?: boolean;
    events?: boolean;
    clientSnippets?: boolean;
  };
  existingProjectMode?: "extend" | "separate";
  modelId?: string;
}
Response 200 (application/json)
{
  ok: true;
  session: {
    id: string;
    projectId: string;
    title: string | null;
    status: string;
    generationTypes?: any;
    generationOptions?: any;
    existingProjectMode: "extend" | "separate";
    createdAt: string | string (date-time);
  };
}

Errors: 401, 403, 404, 500, with the error body.

GET /ai/copilot/sessions/{projectId}

ParameterInTypeRequired
projectIdpathstring (uuid)Yes
Response 200 (application/json)
{
  sessions: {
    id: string;
    title: string;
    summary: null | string;
    status: "active" | "archived" | "completed";
    messageCount: number;
    generationTypes: any[];
    createdAt: string (date-time);
    updatedAt: string (date-time);
    lastMessageAt?: string (date-time);
  } | {
    id: any;
    projectId: any;
    title: any;
    status: any;
    createdAt: any;
    updatedAt: any;
    lastMessageAt: any;
  }[];
}

GET /ai/copilot/session/{sessionId}

ParameterInTypeRequired
sessionIdpathstringYes
Response 200 (application/json)
{
  session: {
    id: any;
    projectId: any;
    title: any;
    status: any;
    createdAt: any;
    updatedAt: any;
    lastMessageAt: any;
  };
} | {
  session: {
    id: string;
    projectId: string;
    title?: string;
    summary?: string;
    status: "active" | "archived" | "completed";
    intentHistory: ("add_analytics" | "add_authentication" | "add_caching" | "add_error_handling" | "add_field" | "add_file_uploads" | "add_index" | "add_logging" | "add_multi_tenancy" | "add_notifications" | "add_payments" | "add_rate_limiting" | "add_relationship" | "add_retry_logic" | "add_search" | "add_webhooks" | "cancel_operation" | "clarify_request" | "compare_approaches" | "confirm_plan" | "estimate_cost" | "explain_code" | "explain_schema" | "follow_up" | "generate_api" | "generate_backend" | "generate_ecommerce" | "generate_fullstack" | "generate_functions" | "generate_marketplace" | "generate_saas" | "generate_schema" | "generate_storage" | "integrate_ai" | "integrate_aws" | "integrate_database" | "integrate_email" | "integrate_oauth" | "integrate_redis" | "integrate_sms" | "integrate_stripe" | "modify_code" | "modify_function" | "modify_schema" | "optimize_database" | "optimize_performance" | "optimize_security" | "remove_feature" | "rename_entity" | "show_history" | "suggest_improvements" | "undo_change" | "unknown" | "vague")[];
    generationTypes: ("backend" | "fullstack" | "functions" | "schema" | "storage")[];
    generationOptions: any;
    existingProjectMode: null | "extend" | "separate";
    messageCount: number;
    totalCreditsUsed: number;
    createdAt: string (date-time);
    updatedAt: string (date-time);
    lastMessageAt?: string (date-time);
  };
  messages: {
    id: string;
    role: "assistant" | "system" | "tool" | "user";
    content: string;
    intent?: "add_analytics" | "add_authentication" | "add_caching" | "add_error_handling" | "add_field" | "add_file_uploads" | "add_index" | "add_logging" | "add_multi_tenancy" | "add_notifications" | "add_payments" | "add_rate_limiting" | "add_relationship" | "add_retry_logic" | "add_search" | "add_webhooks" | "cancel_operation" | "clarify_request" | "compare_approaches" | "confirm_plan" | "estimate_cost" | "explain_code" | "explain_schema" | "follow_up" | "generate_api" | "generate_backend" | "generate_ecommerce" | "generate_fullstack" | "generate_functions" | "generate_marketplace" | "generate_saas" | "generate_schema" | "generate_storage" | "integrate_ai" | "integrate_aws" | "integrate_database" | "integrate_email" | "integrate_oauth" | "integrate_redis" | "integrate_sms" | "integrate_stripe" | "modify_code" | "modify_function" | "modify_schema" | "optimize_database" | "optimize_performance" | "optimize_security" | "remove_feature" | "rename_entity" | "show_history" | "suggest_improvements" | "undo_change" | "unknown" | "vague";
    plan?: {
      id: string;
      intent: any;
      confidence?: any;
      description?: any;
      steps: any[];
      dependencies?: any;
      parallelGroups?: any;
      estimatedTokens: number;
      estimatedCredits: number;
      complexityMultiplier?: any;
      requiresClarification?: any;
      clarificationQuestions?: any;
      status: any;
      executedSteps?: any;
      currentStep?: any;
      warnings?: any;
      createdAt?: any;
      aiGenerated?: any;
      entityMapping?: any;
    };
    artifacts?: {
      schema?: any;
      storage?: any;
      functions?: any;
      files?: any;
      dependencies?: any;
    };
    clarificationQuestions?: {
      id: any;
      question: any;
      type: any;
      options?: any;
      required: any;
      defaultValue?: any;
      context?: any;
    }[];
    suggestions?: string[];
    executed: boolean;
    creditsCharged: number;
    unmetered?: boolean;
    run?: {
      manifestId?: any;
      unmetered: boolean;
      creditsCharged: number;
      tokensUsed: number;
      completedFiles?: any;
      totalFiles?: any;
      tier?: any;
      effort?: any;
      status?: any;
    };
    createdAt: string (date-time);
  }[];
  run: null | {
    state: "finished" | "paused" | "running";
    manifestId: string;
    status: string;
    completedFileIds?: string[];
    failedFileIds?: string[];
    checkpoint?: {
      id: string;
      resumeToken: string;
      expiresAt: string (date-time);
      currentBatch: number;
      totalBatches: number;
      completedFiles: number;
      reason: string;
    };
    manifest?: {
      generationScope?: any;
      id: string;
      sessionId: string;
      projectId: string;
      originalPrompt: string;
      runTurns?: any;
      provided?: any;
      docs?: any;
      typecheckFailures?: any;
      env?: any;
      assumptions?: any;
      generationType: any;
      status: any;
      project: {
        name: any;
        description: any;
        stack: any;
        architecture: any;
        folderStructure: any;
      };
      files: any[];
      fileGroups: any[];
      batches: any[];
      estimates: {
        totalFiles: any;
        totalTokens: any;
        estimatedCredits: any;
        totalBatches: any;
        estimatedDurationSeconds?: any;
        creditsPer1kTokens?: any;
      };
      generationEffort?: any;
      totalEstimatedTokens: number;
      totalActualTokens?: any;
      estimatedCredits: number;
      actualCredits?: any;
      truncatedByProvider?: any;
      createdAt: string (date-time);
      updatedAt: string (date-time);
      startedAt?: any;
      completedAt?: any;
    };
  };
  pendingPlan: null | {
    kind: "plan";
    plan: {
      planId: string;
      expiresAt: string;
      scope: null | {
        scope: any;
        auto: any;
        clear: any;
      };
      files: { … }[];
      fileCount: number;
      batchCount: number;
      planningCredits: number;
      maximumCredits: null | number;
      remainingCredits: null | number;
      credits: null | {
        scope: any;
        maximumCredits: any;
        remainingCredits: any;
        upgradePlan: any;
        smallerRun: any;
        untilZero: any;
      };
      autoConfirm?: {
        maxCredits: any;
        refused: any;
      };
      scopeDecisionId?: string;
      unmetered: boolean;
      engine: null | {
        tier: any;
        tierLabel: any;
        effort: any;
        effortLabel: any;
      };
      assumptions: {
        id: any;
        topic: any;
        text: any;
        choice: any;
        options: any;
      }[];
      provided: {
        path: any;
        reason: any;
      }[];
      docs: null | {
        defaultChoice: any;
        kinds: any;
        noteMax: any;
        maximumCredits: any;
        selections: any;
      };
    };
    messageId: null | string;
    prompt?: string;
  };
  brainstorm: null | {
    id: string;
    status: "approaches" | "asking" | "planned" | "stopped";
    stepId: null | string;
    step: null | {
      kind: "approaches";
      summary: string;
      approaches: any[];
    } | {
      kind: "question";
      playback: string;
      question: string;
      options: any[];
    };
    questionCount: number;
    maxQuestions: number;
    pending: boolean;
  };
}

PATCH /ai/copilot/session/{sessionId}

ParameterInTypeRequired
sessionIdpathstringYes
Request body (application/json, required)
{
  title?: string;
  generationOptions?: {
    scope?: "auto" | "database" | "database-api" | "backend" | "single-piece";
    outputDepth?: "prototype" | "standard" | "production";
    sampleData?: "off" | "few" | "realistic";
    tests?: boolean;
    auth?: "none" | "sign-in" | "roles";
    multiTenant?: boolean;
    rowRules?: "owner" | "org" | "public-read";
    fileStorage?: boolean;
    realtime?: boolean;
    events?: boolean;
    clientSnippets?: boolean;
  };
  existingProjectMode?: "extend" | "separate";
}
Response 200 (application/json)
{
  ok: true;
}

Errors: 401, 403, 404, 500, with the error body.

DELETE /ai/copilot/session/{sessionId}

ParameterInTypeRequired
sessionIdpathstringYes
Response 200 (application/json)
{
  ok: boolean;
}

POST /ai/copilot/session/{sessionId}/brainstorm/stop

ParameterInTypeRequired
sessionIdpathstringYes
Response 200 (application/json)
{
  stopped: true;
}

Errors: 401, 403, 404, 500, with the error body.

GET /ai/copilot/session/{sessionId}/editor-files

ParameterInTypeRequired
sessionIdpathstringYes
Response 200 (application/json)
{
  ok: true;
  files: any[];
  revision: number;
}

PUT /ai/copilot/session/{sessionId}/editor-files

ParameterInTypeRequired
sessionIdpathstringYes
Request body (application/json, required)
{
  files: {
    path: string;
    content: string;
    language?: string;
    type?: string;
  }[];
  baseRevision: number;
}
Response 200 (application/json)
{
  ok: true;
  count: number;
  revision: number;
  warnings?: string[];
}

POST /ai/copilot/execute

Request body (application/json, required)
{
  sessionId: string (uuid);
  planId: string;
  stepIds?: string[];
  dryRun?: boolean;
  tier?: string;
  effort?: string;
}
Response 200 (application/json)
{
  ok: boolean;
  dryRun?: boolean;
  plan?: any;
  results?: any[];
  artifacts?: any;
  error?: any;
}

Errors: 401, 402, 403, 404, 413, 422, 429, 500, 503, with the error body.

GET /ai/copilot/execution/{executionId}

ParameterInTypeRequired
executionIdpathstringYes
Response 200 (application/json)
{
  execution: {
    id: string;
    planId: string;
    sessionId: string;
    status: "completed" | "failed" | "paused" | "pending" | "rolled_back" | "running";
    currentStepIndex: number;
    completedStepIds: string[];
    failedStepIds: string[];
    skippedStepIds: string[];
    checkpoints: {
      id: string;
      stepId: string;
      stepIndex: number;
      createdAt: string (date-time);
    }[];
    startedAt: string (date-time);
    completedAt?: string (date-time);
    error?: string;
  };
  artifacts: {
    schema?: {
      tables: {
        name: any;
        description?: any;
        columns: any;
        primaryKey: any;
        timestamps: any;
        softDelete?: any;
      }[];
      relationships: {
        name: any;
        type: any;
        from: any;
        to: any;
        onDelete?: any;
      }[];
      indexes: {
        name: any;
        table: any;
        columns: any;
        unique: any;
        type?: any;
      }[];
      enums?: any[];
      sql?: string;
    };
    storage?: {
      name: string;
      description?: any;
      public: boolean;
      maxFileSize?: any;
      allowedMimeTypes?: any;
      policies?: any;
    }[];
    functions?: {
      name: string;
      description?: any;
      trigger: any;
      schedule?: any;
      eventType?: any;
      code: string;
      runtime: string;
      memoryMb: number;
      timeoutMs: number;
      secrets?: any;
    }[];
    files?: {
      path: string;
      content: string;
      language: string;
      description?: any;
      type?: any;
    }[];
    dependencies?: {
      [key: string]: string;
    };
  };
  stepResults: {
    stepId: string;
    status: "failed" | "skipped" | "success";
    output?: any;
    error?: string;
    durationMs: number;
    tokensUsed: number;
    creditsCharged: number;
  }[];
}

POST /ai/copilot/execution/{executionId}/pause

ParameterInTypeRequired
executionIdpathstringYes
Response 200 (application/json)
{
  ok: boolean;
  status: string;
}

POST /ai/copilot/execution/{executionId}/resume

ParameterInTypeRequired
executionIdpathstringYes
Request body (application/json, required)
{
  fromCheckpoint?: string;
  tier?: string;
  effort?: string;
}
Response 200 (application/json)
{
  ok: boolean;
  message: string;
  executionId: string;
  fromCheckpoint?: string;
  results: any[];
  resumedTokensUsed: number;
  artifacts?: any;
  error?: any;
}

Errors: 400, 401, 402, 403, 404, 413, 422, 429, 500, 503, with the error body.

POST /ai/copilot/execution/{executionId}/rollback

ParameterInTypeRequired
executionIdpathstringYes
Request body (application/json, required)
{
  checkpointId: string;
}
Response 200 (application/json)
{
  ok: true;
  message: string;
  checkpoint: {
    id: string;
    stepId: string;
    stepIndex: number;
  };
}

Errors: 401, 403, 404, 500, with the error body.

GET /ai/copilot/executions/{sessionId}

ParameterInTypeRequired
sessionIdpathstringYes
Response 200 (application/json)
{
  executions: {
    id: string;
    planId: string;
    status: "completed" | "failed" | "paused" | "pending" | "rolled_back" | "running";
    currentStepIndex: number;
    completedSteps: number;
    failedSteps: number;
    checkpointCount: number;
    startedAt: string (date-time);
    completedAt?: string (date-time);
    error?: string;
  }[];
}

POST /ai/copilot/feedback

Request body (application/json, required)
{
  sessionId: string (uuid);
  messageId: string (uuid);
  feedbackType: "correct" | "incorrect" | "partial";
  correctedIntent?: string;
  userFeedback?: string;
}
Response 200 (application/json)
{
  ok: true;
}

Errors: 401, 403, 404, 500, with the error body.

POST /ai/copilot/training-consent/{sessionId}

ParameterInTypeRequired
sessionIdpathstringYes
Request body (application/json, required)
{
  consent: boolean;
}
Response 200 (application/json)
{
  ok: true;
  consent: boolean;
}

Errors: 401, 403, 404, 500, with the error body.

POST /ai/copilot/rate/{messageId}

ParameterInTypeRequired
messageIdpathstringYes
Request body (application/json, required)
{
  rating: number;
  feedback?: string;
  approved?: boolean;
}
Response 200 (application/json)
{
  ok: true;
}

Errors: 401, 403, 404, 500, with the error body.

GET /ai/copilot/versions/{sessionId}

ParameterInTypeRequired
sessionIdpathstringYes
Response 200 (application/json)
{
  versions: {
    id: string;
    version: number;
    branchName: string;
    fileCount: number;
    totalLines: number;
    summary: null | string;
    commitMessage: null | string;
    generationType: string;
    status: string;
    createdAt: string (date-time);
    modelUsed: null | string;
  }[];
}

GET /ai/copilot/version/{versionId}

ParameterInTypeRequired
versionIdpathstringYes
Response 200 (application/json)
{
  version: {
    id: string;
    sessionId: string;
    version: number;
    branchName: string;
    files: any;
    diffFromParent: any;
    fileCount: number;
    totalLines: number;
    summary: null | string;
    commitMessage: null | string;
    schemaSnapshot: any;
    storageSnapshot: any;
    functionsSnapshot: any;
    generationType: string;
    promptUsed: null | string;
    modelUsed: null | string;
    tokensUsed: number;
    status: string;
    createdAt: string (date-time);
  };
}

GET /ai/copilot/version/{versionId}/diff/{compareVersionId}

ParameterInTypeRequired
versionIdpathstringYes
compareVersionIdpathstringYes
Response 200 (application/json)
{
  fromVersion: number;
  toVersion: number;
  diff: {
    [key: string]: {
      type: "add" | "delete" | "modify";
      before?: string;
      after?: string;
    };
  };
  stats: {
    added: number;
    modified: number;
    deleted: number;
  };
}

POST /ai/copilot/export/{versionId}

ParameterInTypeRequired
versionIdpathstringYes
Request body (application/json)
{
  format?: "files" | "json" | "zip";
  includeSchema?: boolean;
  includeStorage?: boolean;
  includeFunctions?: boolean;
}
Response 200 (application/json)
{
  files: any;
  fileCount: number;
  totalLines: number;
} | {
  format: string;
  data: { [key: string]: any };
  message: string;
}

GET /ai/copilot/models/{projectId}

ParameterInTypeRequired
projectIdpathstring (uuid)Yes
Response 200 (application/json)
{
  version: string;
  changelog: {
    version: string;
    date: string;
    line: string;
  }[];
  defaults: {
    tier: "lite" | "max" | "standard";
    effort: "balanced" | "deep" | "extended" | "quick";
    apiEffort: "high" | "low" | "medium" | "xhigh";
  };
  tiers: {
    id: "lite" | "max" | "standard";
    label: string;
    shortLabel: string;
    tagline: string;
    isDefault: boolean;
    efforts: {
      id: any;
      label: string;
    }[];
    defaultEffort: "balanced" | "deep" | "extended" | "quick";
    creditMultiplier: number;
  }[];
  models: {
    id: "lite" | "max" | "standard";
    name: string;
    displayName: string;
    copilotName: string;
    tagline: string;
    copilotTagline: string;
    tier: "agency" | "enterprise" | "free" | "pro" | "starter" | "studio_plus";
    isDefault: boolean;
    available: boolean;
    multiplier: number;
    creditMultiplier: number;
  }[];
  premiumMultiplier: number;
  skipProviderCheck: boolean;
}

GET /ai/copilot/usage/{projectId}

ParameterInTypeRequired
projectIdpathstring (uuid)Yes
Response 200 (application/json)
{
  projectId: string;
  summary: {
    totalRequests: any;
    totalInputTokens: any;
    totalOutputTokens: any;
    totalCredits: any;
    successCount: any;
    failureCount: any;
    avgLatencyMs: any;
  };
  byModel: {
    count: number;
    totalTokens: number;
    totalCredits: number;
    model: string;
  }[];
  byType: {
    requestType: string;
    count: any;
    totalCredits: any;
  }[];
  premiumMultiplier: number;
  skipProviderCheck: boolean;
}

GET /ai/copilot/usage-org/{orgId}

ParameterInTypeRequired
orgIdpathstringYes
Response 200 (application/json)
{
  orgId: string;
  summary: {
    totalSessions: number;
    totalMessages: number;
    totalCredits: number;
    totalTokens: number;
  };
  byModel: {
    [key: string]: {
      sessions: number;
      messages: number;
      credits: number;
    };
  };
  premiumMultiplier: number;
  skipProviderCheck: boolean;
}

POST /ai/copilot/job

Request body (application/json, required)
{
  projectId: string (uuid);
  sessionId?: string (uuid);
  message: string;
  attachments?: {
    type: "schema" | "function" | "file" | "context";
    name?: string;
    content: string;
  }[];
  generationTypes?: ("schema" | "storage" | "functions" | "backend" | "fullstack")[];
  generationOptions?: {
    scope?: "auto" | "database" | "database-api" | "backend" | "single-piece";
    outputDepth?: "prototype" | "standard" | "production";
    sampleData?: "off" | "few" | "realistic";
    tests?: boolean;
    auth?: "none" | "sign-in" | "roles";
    multiTenant?: boolean;
    rowRules?: "owner" | "org" | "public-read";
    fileStorage?: boolean;
    realtime?: boolean;
    events?: boolean;
    clientSnippets?: boolean;
  };
  modelId?: string;
  tier?: string;
  effort?: string;
  intent?: "explain";
  resumeFromExecution?: string;
  resumeFromCheckpoint?: string;
  autoConfirm?: {
    maxCredits: number;
  };
  preflight?: {
    confirmPlanId: string (uuid);
    creditChoice?: "smaller" | "until_zero";
    assumptionChoices?: {
      [key: string]: string;
    };
    docs?: {
      kinds: ("api" | "guide" | "architecture" | "custom")[];
      note?: string;
    };
  };
}
Response 200 (application/json)
{
  ok: true;
  jobId: string;
  status: string;
  tier: string;
  engine: {
    tier: string;
    tierLabel: string;
    effort: string;
    effortLabel: string;
  };
  eventsUrl: string;
  statusUrl: string;
}

Errors: 400, 401, 402, 403, 404, 409, 410, 429, 500, 503, with the error body.

GET /ai/copilot/job/{jobId}

ParameterInTypeRequired
jobIdpathstringYes
Response 200 (application/json)
{
  jobId: string;
  status: "active" | "completed" | "delayed" | "failed" | "prioritized" | "unknown" | "waiting" | "waiting-children";
  progress?: { [key: string]: any };
  data: {
    projectId: string;
    sessionId?: string;
    tier: "agency" | "enterprise" | "free" | "pro" | "starter" | "studio_plus";
    generationTypes?: ("backend" | "fullstack" | "functions" | "schema" | "storage")[];
  };
  result: {
    jobId: string;
    sessionId: string;
    executionId?: string;
    status: "awaiting_confirmation" | "completed" | "failed" | "paused" | "timeout";
    plan?: {
      planId: string;
      expiresAt: string;
      scope: null | {
        scope: any;
        auto: any;
        clear: any;
      };
      files: {
        path: any;
        description: any;
      }[];
      fileCount: number;
      batchCount: number;
      planningCredits: number;
      maximumCredits: null | number;
      remainingCredits: null | number;
      credits: null | {
        scope: any;
        maximumCredits: any;
        remainingCredits: any;
        upgradePlan: any;
        smallerRun: any;
        untilZero: any;
      };
      autoConfirm?: {
        maxCredits: any;
        refused: any;
      };
      scopeDecisionId?: string;
      unmetered: boolean;
      engine: null | {
        tier: any;
        tierLabel: any;
        effort: any;
        effortLabel: any;
      };
      assumptions: {
        id: any;
        topic: any;
        text: any;
        choice: any;
        options: any;
      }[];
      provided: {
        path: any;
        reason: any;
      }[];
      docs: null | {
        defaultChoice: any;
        kinds: any;
        noteMax: any;
        maximumCredits: any;
        selections: any;
      };
    };
    planId?: string;
    manifestId?: string;
    preflightRequired?: { [key: string]: any };
    resumeToken?: string;
    files?: {
      path: string;
      content: string;
      language?: any;
    }[];
    artifacts?: { [key: string]: any };
    tokensUsed?: number;
    creditsCharged?: number;
    planWithDefaults?: {
      charged: number;
    };
    gap?: {
      kind: "contradiction" | "data_model" | "external_system" | "missing_object" | "other";
      question: string;
      options: string[];
      charged: number;
    };
    error?: string;
    checkpointId?: string;
    code?: string;
    retryable?: boolean;
  };
  failedReason?: string;
  attemptsMade: number;
  createdAt: number;
  processedAt?: number;
  finishedAt?: number;
}

GET /ai/copilot/job/{jobId}/events

ParameterInTypeRequired
jobIdpathstringYes
Response 200

No body.

POST /ai/copilot/job/{jobId}/cancel

ParameterInTypeRequired
jobIdpathstringYes
Response 200 (application/json)
{
  ok: boolean;
  jobId: string;
  status: string;
}

POST /ai/copilot/job/{jobId}/retry

ParameterInTypeRequired
jobIdpathstringYes
Request body (application/json)
{
  fromCheckpoint?: string;
}
Response 200 (application/json)
{
  ok: boolean;
  originalJobId: string;
  newJobId: any;
  status: string;
  resumeFromCheckpoint?: string;
  eventsUrl: string;
}

GET /ai/copilot/metrics/{projectId}

ParameterInTypeRequired
projectIdpathstring (uuid)Yes
rangequerystringNo
Response 200 (application/json)
{
  projectId: string;
  orgId: string;
  range: string;
  startDate: string;
  endDate: string;
  summary: {
    totalRequests: number;
    successfulRequests: number;
    failedRequests: number;
    successRate: number;
    totalTokens: number;
    totalCredits: number;
    totalSessions: number;
    batchCompletionRate: number;
    avgFilesPerSession: number;
  };
  avgLatencyByTier: {
    [key: string]: number;
  };
  tokensByTier: {
    [key: string]: {
      inputTokens: number;
      outputTokens: number;
      totalTokens: number;
    };
  };
  creditsByType: {
    [key: string]: number;
  };
  requestTypeCount: {
    [key: string]: number;
  };
  generationTypeCount: {
    [key: string]: number;
  };
  errorCodes: {
    [key: string]: number;
  };
  tokenTrends: {
    timestamp: string;
    inputTokens: number;
    outputTokens: number;
    totalTokens: number;
    requests: number;
  }[];
}

GET /ai/copilot/metrics/org/{orgId}

ParameterInTypeRequired
orgIdpathstringYes
rangequerystringNo
Response 200 (application/json)
{
  orgId: string;
  range: string;
  startDate: string;
  endDate: string;
  summary: {
    totalRequests: number;
    successfulRequests: number;
    failedRequests: number;
    successRate: number;
    totalTokens: number;
    totalCredits: number;
    uniqueUsers: number;
    uniqueProjects: number;
  };
  projectMetrics: {
    [key: string]: {
      requests: number;
      tokens: number;
      credits: number;
      successRate: number;
    };
  };
  creditsByType: {
    [key: string]: number;
  };
  tokenTrends: {
    timestamp: string;
    inputTokens: number;
    outputTokens: number;
    totalTokens: number;
    requests: number;
  }[];
}

POST /ai/copilot/editor/chat

Request body (application/json, required)
{
  projectId: string (uuid);
  sessionId?: string (uuid);
  message: string;
  files?: {
    path: string;
    content: string;
  }[];
  selectedFile?: string;
  selectedRange?: {
    startLine: number;
    endLine: number;
  };
  history?: {
    role: "user" | "assistant";
    content: string;
  }[];
  mode?: "edit";
  action?: "explain" | "fix" | "rename-suggest" | "add-types" | "add-comments" | "simplify";
  confirmMaxCredits?: number;
}
Response 200

No body.

POST /ai/copilot/memories/{memoryId}/promote

ParameterInTypeRequired
memoryIdpathstringYes
Response 200 (application/json)
{
  success: boolean;
}

POST /ai/copilot/session/{sessionId}/artifact-body

ParameterInTypeRequired
sessionIdpathstringYes
Request body (application/json, required)
{
  path: string;
}
Response 200 (application/json)
{
  kind: "file" | "function" | "schema";
  path: string;
  hash: string;
  language?: string;
  body: string;
  bytes: number;
  tokensCharged: number;
  costCents: number;
}

Errors: 400, 401, 403, 404, 500, with the error body.

GET /ai/copilot/session/{sessionId}/workspace/status

ParameterInTypeRequired
sessionIdpathstringYes
Response 200 (application/json)
{
  ok: boolean;
  workspace: {
    sessionId: string;
    zodMajor: null | 3 | 4;
    status: any;
    stopReason: any;
    state: string;
    phase: any;
    progress: number;
    scope: string;
    files?: {
      path: string;
    }[];
    editorRevision?: any;
    materializedRevision: any;
    problems: {
      id: string;
      severity: "error";
      message: string;
      path: string;
      line: number;
      code: string;
      source: "routes";
      related?: any;
      fixable: boolean;
      free: boolean;
    } | {
      id: string;
      severity: "error";
      message: string;
      path: string;
      line: number;
      code: string;
      source: "typecheck";
      fixable: boolean;
      free: boolean;
    } | {
      id: string;
      severity: string;
      code: string;
      source: string;
      path: string;
      message: string;
      fixable: boolean;
      free: boolean;
    } | {
      id: string;
      severity: string;
      message: any;
      code?: any;
      source?: any;
      path?: any;
      fixable?: any;
      free?: any;
    }[];
    env?: {
      source: "missing" | "project_key";
      keys: string[];
    };
    pipeline?: {
      state: "failed" | "ready" | "running";
      steps: {
        id: any;
        state: any;
        files?: any;
        message?: any;
        pass?: any;
        passes?: any;
        targets?: any;
      }[];
      leaseUntil: null | string;
      pendingRepairs: string[];
    };
    restorable?: {
      files: string[];
    };
    freeFixes?: {
      session: {
        used: number;
        limit: number;
      };
      month: {
        used: number;
        limit: number;
      };
    };
    previews: {
      id: string;
      label: string;
      url: string;
      status: string;
    }[] | {
      id: any;
      label: string;
      host: string;
      status: any;
    }[];
    logs: any;
    handoff: {
      command: string;
      zipUrl: string;
    };
    error: any;
    updatedAt: any;
  };
}

GET /ai/copilot/session/{sessionId}/workspace/types

ParameterInTypeRequired
sessionIdpathstringYes
Response 200 (application/json)
{
  libs: {
    path: string;
    content: string;
  }[];
}

POST /ai/copilot/session/{sessionId}/workspace/prepare

ParameterInTypeRequired
sessionIdpathstringYes
Request body (application/json, required)
{
  scope: "auto" | "database" | "database-api" | "backend" | "single-piece" | "schema-only" | "functions-only" | "backend-only" | "full-application";
  files?: {
    path: string;
    content: string;
    language?: string;
    type?: string;
  }[];
}
Response 200

No body.

Response 202 (application/json)
{
  ok: boolean;
  workspace: null | {
    sessionId: string;
    zodMajor: null | 3 | 4;
    status: any;
    stopReason: any;
    state: string;
    phase: any;
    progress: number;
    scope: string;
    files?: {
      path: any;
    }[];
    editorRevision?: any;
    materializedRevision: any;
    problems: {
      id: any;
      severity: any;
      code: any;
      source: any;
      path: any;
      message: any;
      fixable: any;
      free: any;
    } | {
      id: any;
      severity: any;
      message: any;
      code?: any;
      source?: any;
      path?: any;
      fixable?: any;
      free?: any;
    } | {
      id: any;
      severity: any;
      message: any;
      path: any;
      line: any;
      code: any;
      source: any;
      fixable: any;
      free: any;
    } | {
      id: any;
      severity: any;
      message: any;
      path: any;
      line: any;
      code: any;
      source: any;
      related?: any;
      fixable: any;
      free: any;
    }[];
    env?: {
      source: any;
      keys: any[];
    };
    pipeline?: {
      state: any;
      steps: any[];
      leaseUntil: any;
      pendingRepairs: any[];
    };
    restorable?: {
      files: any[];
    };
    freeFixes?: {
      session: {
        used: any;
        limit: any;
      };
      month: {
        used: any;
        limit: any;
      };
    };
    previews: {
      id: any;
      label: any;
      host: any;
      status: any;
    }[] | {
      id: any;
      label: any;
      url: any;
      status: any;
    }[];
    logs: any;
    handoff: {
      command: string;
      zipUrl: string;
    };
    error: any;
    updatedAt: any;
  };
}

POST /ai/copilot/session/{sessionId}/workspace/env

ParameterInTypeRequired
sessionIdpathstringYes
Response 200 (application/json)
{
  ok: boolean;
  workspace: null | {
    sessionId: string;
    zodMajor: null | 3 | 4;
    status: any;
    stopReason: any;
    state: string;
    phase: any;
    progress: number;
    scope: string;
    files?: {
      path: any;
    }[];
    editorRevision?: any;
    materializedRevision: any;
    problems: {
      id: any;
      severity: any;
      code: any;
      source: any;
      path: any;
      message: any;
      fixable: any;
      free: any;
    } | {
      id: any;
      severity: any;
      message: any;
      code?: any;
      source?: any;
      path?: any;
      fixable?: any;
      free?: any;
    } | {
      id: any;
      severity: any;
      message: any;
      path: any;
      line: any;
      code: any;
      source: any;
      fixable: any;
      free: any;
    } | {
      id: any;
      severity: any;
      message: any;
      path: any;
      line: any;
      code: any;
      source: any;
      related?: any;
      fixable: any;
      free: any;
    }[];
    env?: {
      source: any;
      keys: any[];
    };
    pipeline?: {
      state: any;
      steps: any[];
      leaseUntil: any;
      pendingRepairs: any[];
    };
    restorable?: {
      files: any[];
    };
    freeFixes?: {
      session: {
        used: any;
        limit: any;
      };
      month: {
        used: any;
        limit: any;
      };
    };
    previews: {
      id: any;
      label: any;
      host: any;
      status: any;
    }[] | {
      id: any;
      label: any;
      url: any;
      status: any;
    }[];
    logs: any;
    handoff: {
      command: string;
      zipUrl: string;
    };
    error: any;
    updatedAt: any;
  };
}

POST /ai/copilot/session/{sessionId}/workspace/fix

ParameterInTypeRequired
sessionIdpathstringYes
Request body (application/json, required)
{
  problemIds?: string[];
  paths?: string[];
  confirmMaxCredits?: number;
}
Response 200

No body.

Response 202 (application/json)
{
  ok: boolean;
  free: boolean;
  maximumCredits: number;
  files: string[];
  workspace: null | {
    sessionId: string;
    zodMajor: null | 3 | 4;
    status: any;
    stopReason: any;
    state: string;
    phase: any;
    progress: number;
    scope: string;
    files?: {
      path: any;
    }[];
    editorRevision?: any;
    materializedRevision: any;
    problems: {
      id: any;
      severity: any;
      code: any;
      source: any;
      path: any;
      message: any;
      fixable: any;
      free: any;
    } | {
      id: any;
      severity: any;
      message: any;
      code?: any;
      source?: any;
      path?: any;
      fixable?: any;
      free?: any;
    } | {
      id: any;
      severity: any;
      message: any;
      path: any;
      line: any;
      code: any;
      source: any;
      fixable: any;
      free: any;
    } | {
      id: any;
      severity: any;
      message: any;
      path: any;
      line: any;
      code: any;
      source: any;
      related?: any;
      fixable: any;
      free: any;
    }[];
    env?: {
      source: any;
      keys: any[];
    };
    pipeline?: {
      state: any;
      steps: any[];
      leaseUntil: any;
      pendingRepairs: any[];
    };
    restorable?: {
      files: any[];
    };
    freeFixes?: {
      session: {
        used: any;
        limit: any;
      };
      month: {
        used: any;
        limit: any;
      };
    };
    previews: {
      id: any;
      label: any;
      host: any;
      status: any;
    }[] | {
      id: any;
      label: any;
      url: any;
      status: any;
    }[];
    logs: any;
    handoff: {
      command: string;
      zipUrl: string;
    };
    error: any;
    updatedAt: any;
  };
}

POST /ai/copilot/session/{sessionId}/workspace/restore

ParameterInTypeRequired
sessionIdpathstringYes
Request body (application/json, required)
{
  path: string;
}
Response 200 (application/json)
{
  ok: boolean;
  workspace: null | {
    sessionId: string;
    zodMajor: null | 3 | 4;
    status: any;
    stopReason: any;
    state: string;
    phase: any;
    progress: number;
    scope: string;
    files?: {
      path: any;
    }[];
    editorRevision?: any;
    materializedRevision: any;
    problems: {
      id: any;
      severity: any;
      code: any;
      source: any;
      path: any;
      message: any;
      fixable: any;
      free: any;
    } | {
      id: any;
      severity: any;
      message: any;
      code?: any;
      source?: any;
      path?: any;
      fixable?: any;
      free?: any;
    } | {
      id: any;
      severity: any;
      message: any;
      path: any;
      line: any;
      code: any;
      source: any;
      fixable: any;
      free: any;
    } | {
      id: any;
      severity: any;
      message: any;
      path: any;
      line: any;
      code: any;
      source: any;
      related?: any;
      fixable: any;
      free: any;
    }[];
    env?: {
      source: any;
      keys: any[];
    };
    pipeline?: {
      state: any;
      steps: any[];
      leaseUntil: any;
      pendingRepairs: any[];
    };
    restorable?: {
      files: any[];
    };
    freeFixes?: {
      session: {
        used: any;
        limit: any;
      };
      month: {
        used: any;
        limit: any;
      };
    };
    previews: {
      id: any;
      label: any;
      host: any;
      status: any;
    }[] | {
      id: any;
      label: any;
      url: any;
      status: any;
    }[];
    logs: any;
    handoff: {
      command: string;
      zipUrl: string;
    };
    error: any;
    updatedAt: any;
  };
}

POST /ai/copilot/session/{sessionId}/workspace/repairs/apply

ParameterInTypeRequired
sessionIdpathstringYes
Response 200 (application/json)
{
  ok: true;
  applied: number;
  pending: number;
  editorRevision: number;
}

POST /ai/copilot/session/{sessionId}/workspace/install

ParameterInTypeRequired
sessionIdpathstringYes
Response 200

No body.

Response 202 (application/json)
{
  ok: boolean;
  workspace: null | {
    sessionId: string;
    zodMajor: null | 3 | 4;
    status: any;
    stopReason: any;
    state: string;
    phase: any;
    progress: number;
    scope: string;
    files?: {
      path: any;
    }[];
    editorRevision?: any;
    materializedRevision: any;
    problems: {
      id: any;
      severity: any;
      code: any;
      source: any;
      path: any;
      message: any;
      fixable: any;
      free: any;
    } | {
      id: any;
      severity: any;
      message: any;
      code?: any;
      source?: any;
      path?: any;
      fixable?: any;
      free?: any;
    } | {
      id: any;
      severity: any;
      message: any;
      path: any;
      line: any;
      code: any;
      source: any;
      fixable: any;
      free: any;
    } | {
      id: any;
      severity: any;
      message: any;
      path: any;
      line: any;
      code: any;
      source: any;
      related?: any;
      fixable: any;
      free: any;
    }[];
    env?: {
      source: any;
      keys: any[];
    };
    pipeline?: {
      state: any;
      steps: any[];
      leaseUntil: any;
      pendingRepairs: any[];
    };
    restorable?: {
      files: any[];
    };
    freeFixes?: {
      session: {
        used: any;
        limit: any;
      };
      month: {
        used: any;
        limit: any;
      };
    };
    previews: {
      id: any;
      label: any;
      host: any;
      status: any;
    }[] | {
      id: any;
      label: any;
      url: any;
      status: any;
    }[];
    logs: any;
    handoff: {
      command: string;
      zipUrl: string;
    };
    error: any;
    updatedAt: any;
  };
}

POST /ai/copilot/session/{sessionId}/workspace/approve-scripts

ParameterInTypeRequired
sessionIdpathstringYes
Response 200

No body.

POST /ai/copilot/session/{sessionId}/workspace/run

ParameterInTypeRequired
sessionIdpathstringYes
Response 200 (application/json)
{
  ok: boolean;
  workspace: null | {
    sessionId: string;
    zodMajor: null | 3 | 4;
    status: any;
    stopReason: any;
    state: string;
    phase: any;
    progress: number;
    scope: string;
    files?: {
      path: any;
    }[];
    editorRevision?: any;
    materializedRevision: any;
    problems: {
      id: any;
      severity: any;
      code: any;
      source: any;
      path: any;
      message: any;
      fixable: any;
      free: any;
    } | {
      id: any;
      severity: any;
      message: any;
      code?: any;
      source?: any;
      path?: any;
      fixable?: any;
      free?: any;
    } | {
      id: any;
      severity: any;
      message: any;
      path: any;
      line: any;
      code: any;
      source: any;
      fixable: any;
      free: any;
    } | {
      id: any;
      severity: any;
      message: any;
      path: any;
      line: any;
      code: any;
      source: any;
      related?: any;
      fixable: any;
      free: any;
    }[];
    env?: {
      source: any;
      keys: any[];
    };
    pipeline?: {
      state: any;
      steps: any[];
      leaseUntil: any;
      pendingRepairs: any[];
    };
    restorable?: {
      files: any[];
    };
    freeFixes?: {
      session: {
        used: any;
        limit: any;
      };
      month: {
        used: any;
        limit: any;
      };
    };
    previews: {
      id: any;
      label: any;
      host: any;
      status: any;
    }[] | {
      id: any;
      label: any;
      url: any;
      status: any;
    }[];
    logs: any;
    handoff: {
      command: string;
      zipUrl: string;
    };
    error: any;
    updatedAt: any;
  };
}

POST /ai/copilot/session/{sessionId}/workspace/stop

ParameterInTypeRequired
sessionIdpathstringYes
Response 200 (application/json)
{
  ok: boolean;
  workspace: null | {
    sessionId: string;
    zodMajor: null | 3 | 4;
    status: any;
    stopReason: any;
    state: string;
    phase: any;
    progress: number;
    scope: string;
    files?: {
      path: any;
    }[];
    editorRevision?: any;
    materializedRevision: any;
    problems: {
      id: any;
      severity: any;
      code: any;
      source: any;
      path: any;
      message: any;
      fixable: any;
      free: any;
    } | {
      id: any;
      severity: any;
      message: any;
      code?: any;
      source?: any;
      path?: any;
      fixable?: any;
      free?: any;
    } | {
      id: any;
      severity: any;
      message: any;
      path: any;
      line: any;
      code: any;
      source: any;
      fixable: any;
      free: any;
    } | {
      id: any;
      severity: any;
      message: any;
      path: any;
      line: any;
      code: any;
      source: any;
      related?: any;
      fixable: any;
      free: any;
    }[];
    env?: {
      source: any;
      keys: any[];
    };
    pipeline?: {
      state: any;
      steps: any[];
      leaseUntil: any;
      pendingRepairs: any[];
    };
    restorable?: {
      files: any[];
    };
    freeFixes?: {
      session: {
        used: any;
        limit: any;
      };
      month: {
        used: any;
        limit: any;
      };
    };
    previews: {
      id: any;
      label: any;
      host: any;
      status: any;
    }[] | {
      id: any;
      label: any;
      url: any;
      status: any;
    }[];
    logs: any;
    handoff: {
      command: string;
      zipUrl: string;
    };
    error: any;
    updatedAt: any;
  };
}

POST /ai/copilot/session/{sessionId}/workspace/heartbeat

ParameterInTypeRequired
sessionIdpathstringYes
Response 200 (application/json)
{
  ok: boolean;
  idleDeadlineAt: string;
}

POST /ai/copilot/session/{sessionId}/workspace/release

ParameterInTypeRequired
sessionIdpathstringYes
Response 200 (application/json)
{
  ok: boolean;
  released: boolean;
}

POST /ai/copilot/session/{sessionId}/workspace/preview/{target}/open

ParameterInTypeRequired
sessionIdpathstringYes
targetpathstringYes
Response 200

No body.

POST /ai/copilot/session/{sessionId}/workspace/preview/reset

ParameterInTypeRequired
sessionIdpathstringYes
Response 200

No body.

GET /ai/copilot/session/{sessionId}/workspace/export

ParameterInTypeRequired
sessionIdpathstringYes
Response 200 (application/json)
{
  files: {
    path: any;
    content: any;
    type: any;
  }[];
  stripped: string[];
}

GET /ai/copilot/autocomplete

ParameterInTypeRequired
projectIdquerystringYes
qquerystringNo
kindsquerystringNo
envIdquerystringNo
limitquerynumberNo
Response 200 (application/json)
{
  projectId: string;
  envId: null | string;
  q: string;
  suggestions: {
    kind: "column" | "function" | "sdk" | "sql" | "table";
    label: string;
    insertText: string;
    detail: null | string;
    score: number;
  }[];
  source: {
    tables: number;
    functions: number;
    schemaSnapshot: boolean;
  };
}

POST /ai/copilot/table-filters/estimate

Price a Verament table-filter request before it runs (no model call, nothing charged)

Request body (application/json, required)
{
  projectId: string (uuid);
  table: string;
  columns: {
    name: string;
    type: string;
  }[];
  prompt: string;
  confirmMaxCredits?: number;
}
Response 200 (application/json)
{
  maximumCredits: number | null;
  ceilingCredits: number;
  autoRun: boolean;
}

Errors: 400, 401, 403, 404, 503, with the error body.

POST /ai/copilot/table-filters

Turn a sentence into editable Table Editor filter chips with Verament (never runs a query)

Request body (application/json, required)
{
  projectId: string (uuid);
  table: string;
  columns: {
    name: string;
    type: string;
  }[];
  prompt: string;
  confirmMaxCredits?: number;
}
Response 200 (application/json)
{
  filters: {
    column: string;
    op: "eq" | "neq" | "gt" | "gte" | "lt" | "lte" | "contains" | "is-null" | "not-null";
    value: string;
  }[];
  note: string | null;
  chargedCredits: number;
  unmetered: boolean;
}

Errors: 400, 401, 402, 403, 404, 409, 422, 429, 500, 502, 503, with the error body.

POST /ai/copilot/alert-rule-suggestion/estimate

Price a Verament alert-rule suggestion before it runs (no model call, nothing charged)

Request body (application/json, required)
{
  projectId: string (uuid);
  envId: string;
  prompt?: string;
  confirmMaxCredits?: number;
}
Response 200 (application/json)
{
  maximumCredits: number | null;
  ceilingCredits: number;
  autoRun: boolean;
}

Errors: 400, 401, 403, 404, 503, with the error body.

POST /ai/copilot/alert-rule-suggestion

Suggest one alert rule from the environment's recent errors and the user's words with Verament (a draft; nothing is created)

Request body (application/json, required)
{
  projectId: string (uuid);
  envId: string;
  prompt?: string;
  confirmMaxCredits?: number;
}
Response 200 (application/json)
{
  rule: {
    name: string;
    source: "api" | "functions" | "realtime";
    severity: "low" | "medium" | "high" | "critical";
    enabled: true;
    envId: string | null;
    threshold: {
      windowMinutes?: number;
      errorRate?: number;
      p95Ms?: number;
      disconnects?: number;
    };
  };
  note: string | null;
  chargedCredits: number;
  unmetered: boolean;
}

Errors: 400, 401, 402, 403, 404, 409, 422, 429, 500, 502, 503, with the error body.

POST /ai/copilot/deploy

Deploy Verament-generated resources (SSE stream)

Request body (application/json, required)
{
  projectId: string (uuid);
  sessionId?: string (uuid);
  resources: {
    id: string;
    type: "schema" | "storage" | "functions" | "routes" | "cron" | "auth";
    content: string;
    path: string;
    name?: string;
  }[];
  dryRun?: boolean;
  confirmProduction?: boolean;
  confirmEnvironmentName?: string;
  envId?: string;
}
Response 200

No body.

GET /ai/copilot/deploy/{deployId}

Get a single deploy record

ParameterInTypeRequired
deployIdpathstring (uuid)Yes
Response 200 (application/json)
{
  id: string;
  projectId: string;
  userId: string;
  sessionId: null | string;
  resources: any;
  status: string;
  preDeployState: any;
  results: any;
  dryRun: boolean;
  errorMessage: null | string;
  createdAt: string (date-time);
  completedAt: null | string (date-time);
  rolledBackAt: null | string (date-time);
}

Errors: 400, 401, 403, 404, with the error body.

GET /ai/copilot/deploy/history/{projectId}

List deploy history for a project

ParameterInTypeRequired
limitquerynumberNo
offsetquerynumberNo
statusquery"success" | "failed" | "partial_failure" | "rolled_back" | "in_progress"No
projectIdpathstring (uuid)Yes
Response 200 (application/json)
{
  deploys: any[];
  pagination: {
    limit: number;
    offset: number;
    hasMore: boolean;
  };
}

Errors: 400, 401, 403, with the error body.

POST /ai/copilot/deploy/{deployId}/rollback

Rollback a deploy (SSE stream)

ParameterInTypeRequired
deployIdpathstring (uuid)Yes
Response 200

No body.

POST /ai/copilot/export/zip

Request body (application/json)
{
  projectId: string;
  projectName?: string;
  sessionId?: string;
  files: {
    path: string;
    content: string;
    type?: string;
  }[];
}
Response 200

No body.

POST /ai/copilot/export/docker

Request body (application/json)
{
  projectId: string;
  projectName?: string;
  sessionId?: string;
  files: {
    path: string;
    content: string;
    type?: string;
  }[];
  nodeVersion?: string;
  appPort?: number;
}
Response 200

No body.

POST /ai/copilot/export/terraform/gcp

Request body (application/json)
{
  projectId: string;
  projectName?: string;
  sessionId?: string;
  files: {
    path: string;
    content: string;
    type?: string;
  }[];
  appSlug?: string;
  dbName?: string;
}
Response 200

No body.

POST /ai/copilot/export/terraform/aws

Request body (application/json)
{
  projectId: string;
  projectName?: string;
  sessionId?: string;
  files: {
    path: string;
    content: string;
    type?: string;
  }[];
  appSlug?: string;
  dbName?: string;
}
Response 200

No body.

POST /ai/copilot/export/github

Request body (application/json)
{
  projectId: string;
  repoOwner: string;
  repoName: string;
  baseBranch?: string;
  token: string;
  files: {
    path: string;
    content: string;
  }[];
  commitMessage?: string;
  prTitle?: string;
  prBody?: string;
}
Response 200 (application/json)
{
  ok: boolean;
  branch: string;
  commitSha: string;
  prNumber: number;
  prUrl: string;
  stripped: string[];
}

POST /ai/copilot/git/clone

Request body (application/json)
{
  sessionId: string;
  projectId: string;
  url: string;
  branch?: string;
  provider: "bitbucket" | "github" | "gitlab";
  token: string;
}
Response 200 (application/json)
{
  ok: boolean;
  sessionId: string;
}

POST /ai/copilot/git/init

Request body (application/json)
{
  sessionId: string;
  projectId: string;
  provider: "bitbucket" | "github" | "gitlab";
  token: string;
}
Response 200 (application/json)
{
  ok: boolean;
  sessionId: string;
}

POST /ai/copilot/git/commit

Request body (application/json)
{
  sessionId: string;
  message: string;
  authorName: string;
  authorEmail: string;
}
Response 200 (application/json)
{
  ok: boolean;
  sha: string;
}

POST /ai/copilot/git/push

Request body (application/json)
{
  sessionId: string;
  branch?: string;
}
Response 200 (application/json)
{
  ok: boolean;
}

POST /ai/copilot/git/pull

Request body (application/json)
{
  sessionId: string;
  branch?: string;
}
Response 200 (application/json)
{
  ok: boolean;
  conflicts: string[];
}

GET /ai/copilot/git/status/{sessionId}

ParameterInTypeRequired
sessionIdpathstringYes
Response 200 (application/json)
{
  files: {
    path: string;
    status: "added" | "deleted" | "modified" | "new" | "unknown";
  }[];
}

GET /ai/copilot/git/log/{sessionId}

ParameterInTypeRequired
sessionIdpathstringYes
Response 200 (application/json)
{
  commits: {
    sha: string;
    message: string;
    author: string;
    date: string (date-time);
  }[];
}

GET /ai/copilot/git/branches/{sessionId}

ParameterInTypeRequired
sessionIdpathstringYes
Response 200 (application/json)
{
  branches: string[];
  current?: string;
}

POST /ai/copilot/git/branch

Request body (application/json)
{
  sessionId: string;
  name: string;
  checkout?: boolean;
}
Response 200 (application/json)
{
  ok: boolean;
  branch: string;
  checkedOut: boolean;
}

POST /ai/copilot/git/write

Request body (application/json)
{
  sessionId: string;
  path: string;
  content: string;
}
Response 200 (application/json)
{
  ok: boolean;
  path: string;
}

GET /ai/copilot/git/files/{sessionId}

ParameterInTypeRequired
sessionIdpathstringYes
Response 200 (application/json)
{
  files: string[];
}