Circle V2 API Docs
    Preparing search index...
    formRunsRouter: BuiltRouter<
        {
            ctx: TRPCContext;
            errorShape: DefaultErrorShape;
            meta: object;
            transformer: false;
        },
        DecorateCreateRouterOptions<
            {
                deleteDocument: MutationProcedure<
                    {
                        input: { runId: string };
                        meta: object;
                        output: { deleted: boolean; runId: FormRunId };
                    },
                >;
                download: QueryProcedure<
                    {
                        input: { runId: string };
                        meta: object;
                        output: {
                            expiresInSeconds: number;
                            fileName: string | null;
                            isStale: boolean;
                            patientChartId: PatientChartId;
                            runId: FormRunId;
                            signedUrl: string;
                        };
                    },
                >;
                getAnswers: QueryProcedure<
                    {
                        input: { runId: string };
                        meta: object;
                        output: {
                            answers: {
                                annotationId: string;
                                annotationPrompt: string | null;
                                annotationType: "ai_prompt" | "checkbox" | "text" | "contact";
                                answerId: string;
                                canRevertToAiAnswer: boolean;
                                citations: unknown;
                                contactLink: { contactTypeName: string; fieldKey: string } | null;
                                contextSources: NormalizedContextSource[];
                                coordinates: FormAnswerCoordinate[];
                                coordinatesSource: CoordinateSource;
                                createdAt: string | null;
                                fieldStatus: FormRunFieldStatus;
                                fontSize: string | null;
                                generatedByAi: boolean | null;
                                isExclusive: boolean | null;
                                noAnswerReason: NoAnswerReasonCode | null;
                                status: string | null;
                                subfieldProgress: { filled: number; total: number } | null;
                                updatedAt: string | null;
                                value: DecodedAnswerValue;
                            }[];
                            formId: string & { __brand: "FormId" };
                            isTerminal: boolean;
                            runId: FormRunId;
                            status: string;
                        };
                    },
                >;
                getRetrievalScope: QueryProcedure<
                    {
                        input: { runId: string };
                        meta: object;
                        output: {
                            runId: FormRunId;
                            scope:
                                | {
                                    includeEmr: boolean;
                                    selectedDocumentIds: PatientChartId[];
                                    selectedSessionIds: SessionId[];
                                }
                                | null;
                        };
                    },
                >;
                getStatus: QueryProcedure<
                    {
                        input: { runId: string };
                        meta: object;
                        output: {
                            createdAt: DbDate | null;
                            errorMsg: string | null;
                            finishedAt: string & { __brand: "DbDate" } | null;
                            formId: string & { __brand: "FormId" };
                            isTerminal: boolean;
                            patientId: string & { __brand: "PatientId" } | null;
                            progress: FormRunProgress;
                            runId: FormRunId;
                            status: string;
                            totalFieldsSource: TotalFieldsSource;
                        };
                    },
                >;
                getTemplateUrl: QueryProcedure<
                    {
                        input: { runId: string };
                        meta: object;
                        output:
                            | { expiresInSeconds: null; runId: FormRunId; signedUrl: null }
                            | { expiresInSeconds: number; runId: FormRunId; signedUrl: string };
                    },
                >;
                listForms: QueryProcedure<
                    {
                        input: void;
                        meta: object;
                        output: {
                            items: {
                                annotationCount: number;
                                context: string
                                | null;
                                createdAt: DbDate;
                                createdBy: UserId | null;
                                defaultFontSize: string | null;
                                fileName: string | null;
                                fileUrl: string | null;
                                id: FormId;
                                orgId: number & { __brand: ... } | null;
                                requiredContactTypes: FormTemplateRequiredContactType[];
                                shareWithOrg: boolean;
                                updatedAt: DbDate | null;
                            }[];
                        };
                    },
                >;
                refreshDocument: MutationProcedure<
                    {
                        input: { runId: string };
                        meta: object;
                        output: { document: EditedDocumentState; runId: FormRunId };
                    },
                >;
                rerun: MutationProcedure<
                    {
                        input: {
                            chosenContacts?: Record<string, string>;
                            includeEmr?: boolean;
                            runId: string;
                            selectedDocumentIds?: string[];
                            selectedSessionIds?: string[];
                            treatmentEpisodeId?: string;
                        };
                        meta: object;
                        output: {
                            patientChartId: PatientChartId;
                            previousRunId: FormRunId;
                            runId: FormRunId;
                            status: "queued";
                        };
                    },
                >;
                revertAnswer: MutationProcedure<
                    {
                        input: {
                            annotationId: string;
                            deferRender?: boolean;
                            runId: string;
                        };
                        meta: object;
                        output: {
                            answer: {
                                annotationId: string;
                                annotationPrompt: string
                                | null;
                                annotationType: "ai_prompt" | "checkbox" | "text" | "contact";
                                answerId: string;
                                canRevertToAiAnswer: boolean;
                                citations: unknown;
                                contactLink: { contactTypeName: string; fieldKey: string } | null;
                                contextSources: NormalizedContextSource[];
                                coordinates: FormAnswerCoordinate[];
                                coordinatesSource: CoordinateSource;
                                createdAt: string | null;
                                fieldStatus: FormRunFieldStatus;
                                fontSize: string | null;
                                generatedByAi: boolean | null;
                                isExclusive: boolean | null;
                                noAnswerReason: NoAnswerReasonCode | null;
                                status: string | null;
                                subfieldProgress: { filled: number; total: number } | null;
                                updatedAt: string | null;
                                value: DecodedAnswerValue;
                            };
                            document: EditedDocumentState;
                            runId: FormRunId;
                        };
                    },
                >;
                start: MutationProcedure<
                    {
                        input: {
                            chosenContacts?: Record<string, string>;
                            formId: string;
                            includeEmr?: boolean;
                            patientId: string;
                            selectedDocumentIds?: string[];
                            selectedSessionIds?: string[];
                            treatmentEpisodeId?: string;
                        };
                        meta: object;
                        output: {
                            patientChartId: PatientChartId;
                            runId: FormRunId;
                            status: "queued";
                        };
                    },
                >;
                updateAnswer: MutationProcedure<
                    {
                        input: {
                            annotationId: string;
                            deferRender?: boolean;
                            fontSize?: number
                            | null;
                            runId: string;
                            value:
                                | { kind: "simple"; values: string[] }
                                | {
                                    kind: "subfields";
                                    subfields: Record<
                                        string,
                                        { fontSize?: (...)
                                        | (...); value: string },
                                    >;
                                }
                                | { kind: "null" };
                        };
                        meta: object;
                        output: {
                            answer: {
                                annotationId: string;
                                annotationPrompt: string
                                | null;
                                annotationType: "ai_prompt" | "checkbox" | "text" | "contact";
                                answerId: string;
                                canRevertToAiAnswer: boolean;
                                citations: unknown;
                                contactLink: { contactTypeName: string; fieldKey: string } | null;
                                contextSources: NormalizedContextSource[];
                                coordinates: FormAnswerCoordinate[];
                                coordinatesSource: CoordinateSource;
                                createdAt: string | null;
                                fieldStatus: FormRunFieldStatus;
                                fontSize: string | null;
                                generatedByAi: boolean | null;
                                isExclusive: boolean | null;
                                noAnswerReason: NoAnswerReasonCode | null;
                                status: string | null;
                                subfieldProgress: { filled: number; total: number } | null;
                                updatedAt: string | null;
                                value: DecodedAnswerValue;
                            };
                            document: EditedDocumentState;
                            runId: FormRunId;
                        };
                    },
                >;
            },
        >,
    > = ...

    Form generation. EVERY procedure carries the formFillingEnabled org setting, the formGenV2 flag, then a resource gate that authorizes ONE id; sibling ids in the payload are proven per procedure.