> ## Documentation Index
> Fetch the complete documentation index at: https://developers.factify.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Get plan

> Returns the plan with inline claim_slots and submissions. body_md_resolved is populated only after the plan is locked.



## OpenAPI

````yaml /openapi.json get /v1/plans/{planId}
openapi: 3.1.0
info:
  title: Factify API
  version: 1.1.1
  description: >-
    Factify API enables organizations to ingest records, manage workflows, and
    extract auditable facts.


    ## Authentication


    Bearer authentication header of the form `Bearer <token>`, where `<token>`
    is your auth token.


    ```

    Authorization: Bearer ffy_prod_<base32_uuid><base62_random>

    ```


    ## Rate Limiting


    Per-API-key rate limits apply. Concrete thresholds are configured per

    deployment and surface via standard `Retry-After` and `RateLimit-*`

    response headers when a request is throttled.


    ## Errors


    Factify uses conventional HTTP status codes and returns structured error
    responses following [RFC 9457](https://www.rfc-editor.org/rfc/rfc9457)
    (Problem Details for HTTP APIs).
  contact:
    name: Factify API Support
    email: api@factify.com
    url: https://factify.com/support
  license:
    name: Proprietary
    url: https://factify.com/terms
servers:
  - url: https://api.factify.com
    description: Production
security:
  - bearerAuth: []
tags:
  - name: Organizations
    description: Organizations and their settings.
  - name: Members
    description: Membership roster and roles within an organization.
  - name: Invitations
    description: Pending invitations to join an organization.
  - name: Users
    description: The authenticated user's profile.
  - name: ApiKeys
    description: API keys used to authenticate SDK and integration callers.
  - name: Usage
    description: |
      Per-organization usage and quota limits. Future operations covering
      API-key-level quotas and usage history land here too.
  - name: Connections
    description: Inbound integration connections that records are ingested from.
  - name: Workflows
    description: Workflow templates that define the rubric set for fact extraction.
  - name: Plans
    description: Workflow instances — bind claims and lock to produce an extraction spec.
  - name: Records
    description: Generic JSON records ingested for claim extraction.
  - name: Audit
    description: Unified audit and provenance events.
  - name: Notifications
    description: In-app notification feed backed by audit events and per-user read state.
  - name: Internal
    description: Internal callbacks not intended for public SDK consumers.
  - name: RubricContentions
    description: >-
      Rubric contention detection and resolution — surface and resolve competing
      claim bindings.
  - name: IdentityProviders
    description: Per-organization SAML identity providers for SSO.
  - name: Analytics
    description: >-
      Org-scoped execution analytics — volume, decision breakdown, and latency
      over plan executions.
  - name: Auth
    description: |
      Browser-facing authentication surface — CSRF, session, OAuth callback,
      OTP, passkey, and refresh-token endpoints. These predate factapi's
      versioned `/v1/*` SDK surface and use the BetterAuth wire format the
      workspace SPA already speaks; SDK generators skip them via
      `x-speakeasy-ignore`.
paths:
  /v1/plans/{planId}:
    get:
      tags:
        - Plans
      summary: Get plan
      description: >-
        Returns the plan with inline claim_slots and submissions.
        body_md_resolved is populated only after the plan is locked.
      operationId: getPlan
      parameters:
        - name: planId
          in: path
          required: true
          schema:
            type: string
          description: Plan TypeID (pln_…)
      responses:
        '200':
          description: Plan found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Plan'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
        '422':
          $ref: '#/components/responses/UnprocessableEntity'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/InternalServerError'
components:
  schemas:
    Plan:
      type: object
      required:
        - id
        - name
        - workflow_id
        - activity_state
        - claim_slots
        - submissions
        - created_at
        - open_conflicts_count
        - total_conflicts_count
      additionalProperties: false
      properties:
        id:
          type: string
          description: Plan TypeID (pln_…)
        name:
          type: string
          description: Human-readable case name.
        workflow_id:
          type: string
          description: Workflow TypeID.
        activity_state:
          type: string
          enum:
            - IDLE
            - PROCESSING
          description: |
            Server-computed activity state, derived from submission states:
              IDLE — no submission is currently ingesting.
              PROCESSING — at least one submission is still ingesting.

            Plan lock status is conveyed separately by `locked_at`
            (null = unlocked, set = locked).
        locked_at:
          type: string
          format: date-time
          nullable: true
          description: When the plan was locked. Null for unlocked plans.
        body_md_resolved:
          type: string
          nullable: true
          description: >-
            Workflow body_md with claim values substituted. Null until the plan
            is locked.
        claim_slots:
          type: array
          description: One entry per rubric in the parent workflow, in creation order.
          items:
            $ref: '#/components/schemas/ClaimSlot'
        submissions:
          type: array
          description: All submissions associated with this plan.
          items:
            $ref: '#/components/schemas/Submission'
        created_at:
          type: string
          format: date-time
        open_conflicts_count:
          type: integer
          format: int32
          minimum: 0
          description: |
            Number of claim_conflicts in `open` status whose new claim was
            submitted to this plan. Drives the runs-list "N conflicts" badge
            and the per-run conflict tab count without forcing the UI to
            N+1 on /v1/conflicts per plan.
        total_conflicts_count:
          type: integer
          format: int32
          minimum: 0
          description: |
            Total number of claim_conflicts (open + accepted + rejected) whose
            new claim was submitted to this plan. Backs resolved-since-detection
            telemetry and the "0/3 unresolved" style breakdown.
    ClaimSlot:
      type: object
      required:
        - rubric_id
      additionalProperties: false
      properties:
        rubric_id:
          type: string
          description: Rubric TypeID that defines this slot.
        slot_name:
          type: string
          description: |
            The rubric's declared slot name (e.g. "invoice_ref"). Stable
            handle agents can use to address the slot without knowing the
            rubric_id.
        claim_id:
          type: string
          nullable: true
          description: >-
            Claim TypeID bound to this slot. Null when no claim has been bound
            yet.
        substitution_value:
          type: string
          nullable: true
          description: |
            The bound claim's resolved value (the same value used in
            body_md_resolved substitution). Null when the slot is unbound.
            Workflow bodies (L4 /execute) consume this to assemble their
            input from bound slots without extra round-trips.
    Submission:
      type: object
      required:
        - id
        - plan_id
        - state
        - filename
        - mime_type
        - added_at
      additionalProperties: false
      properties:
        id:
          type: string
          description: Submission TypeID (sub_…)
        plan_id:
          type: string
          description: Plan TypeID.
        record_id:
          type: string
          format: uuid
          nullable: true
          description: >-
            Record UUID once the document has been ingested. Null while state is
            PROCESSING.
        state:
          type: string
          enum:
            - PROCESSING
            - READY
          description: |
            PROCESSING — document received, ingestion in flight.
            READY — processing finished; the agent should re-check the
              plan's claim slots. Collapses successful extraction,
              zero-match extraction, and ingest failure into one terminal
              state.
        filename:
          type: string
        mime_type:
          type: string
        params:
          type: object
          additionalProperties: true
          description: |
            Consumer-supplied opaque JSON attached at submit time. Not
            interpreted by the API in this increment; echoed back as
            provided. Defaults to an empty object when the caller supplies
            none.
        added_at:
          type: string
          format: date-time
    ErrorModel:
      additionalProperties: false
      type: object
      properties:
        detail:
          type: string
          description: >-
            A human-readable explanation specific to this occurrence of the
            problem.
          example: Property foo is required but is missing.
        errors:
          description: Optional list of individual error details
          type: array
          items:
            $ref: '#/components/schemas/ErrorDetail'
        instance:
          type: string
          format: uri
          description: >-
            A URI reference that identifies the specific occurrence of the
            problem.
          example: https://example.com/error-log/abc123
        status:
          type: integer
          format: int64
          description: HTTP status code
          example: 400
        title:
          type: string
          description: >-
            A short, human-readable summary of the problem type. This value
            should not change between occurrences of the error.
          example: Bad Request
        type:
          type: string
          format: uri
          default: about:blank
          description: A URI reference to human-readable documentation for the error.
          example: https://example.com/errors/example
    ErrorDetail:
      additionalProperties: false
      type: object
      properties:
        location:
          type: string
          description: >-
            Where the error occurred, e.g. 'body.items[3].tags' or
            'path.thing-id'
        message:
          type: string
          description: Error message text
        value:
          description: The value at the given location
  responses:
    Unauthorized:
      description: Unauthorized
      content:
        application/problem+json:
          schema:
            $ref: '#/components/schemas/ErrorModel'
          example:
            type: about:blank
            title: Unauthorized
            status: 401
            detail: Missing or invalid authentication credentials.
    NotFound:
      description: Not Found
      content:
        application/problem+json:
          schema:
            $ref: '#/components/schemas/ErrorModel'
          example:
            type: about:blank
            title: Not Found
            status: 404
            detail: >-
              The requested resource does not exist or you do not have
              permission to view it.
    UnprocessableEntity:
      description: Unprocessable Entity
      content:
        application/problem+json:
          schema:
            $ref: '#/components/schemas/ErrorModel'
          example:
            type: about:blank
            title: Unprocessable Entity
            status: 422
            detail: Request body failed validation.
            errors:
              - location: body.email
                message: expected string to match format 'email'
                value: not-an-email
    TooManyRequests:
      description: Too Many Requests
      content:
        application/problem+json:
          schema:
            $ref: '#/components/schemas/ErrorModel'
          example:
            type: about:blank
            title: Too Many Requests
            status: 429
            detail: >-
              Rate limit exceeded. Retry after the period indicated by the
              Retry-After header.
    InternalServerError:
      description: Internal Server Error
      content:
        application/problem+json:
          schema:
            $ref: '#/components/schemas/ErrorModel'
          example:
            type: about:blank
            title: Internal Server Error
            status: 500
            detail: >-
              An unexpected error occurred. Retry, and contact support if the
              issue persists.
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: API Key
      description: |
        Bearer authentication using a factapi-issued API key
        (`ffy_<env>_<base32_uuid><base62_random>`). Cookie-based
        sessions are accepted automatically by user-facing endpoints
        but are not surfaced as an OpenAPI auth scheme.

````