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

# Create Analysis

> Create a new analysis with URLs and structured prompts.

This endpoint creates an analysis but does NOT automatically run it.
Use POST /{id}/run to start processing after creation.

Accepts either existing structured prompt IDs or new prompt definitions.
You must provide exactly one of these options.



## OpenAPI

````yaml /openapi-web.json post /v1/analyses/
openapi: 3.1.0
info:
  title: GreetIncs API
  description: Analyze any business via API
  version: 0.1.0
servers: []
security: []
tags:
  - name: health
    x-displayName: Health
  - name: analyses
    x-displayName: Analyses
  - name: prompts
    x-displayName: Prompts
paths:
  /v1/analyses/:
    post:
      tags:
        - analyses
      summary: Create Analysis
      description: |-
        Create a new analysis with URLs and structured prompts.

        This endpoint creates an analysis but does NOT automatically run it.
        Use POST /{id}/run to start processing after creation.

        Accepts either existing structured prompt IDs or new prompt definitions.
        You must provide exactly one of these options.
      operationId: createAnalysis
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: >-
                #/components/schemas/app__api__v1__analyses__schemas__AnalysisCreateRequest
      responses:
        '201':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/app__api__v1__analyses__schemas__AnalysisCreateResponse
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '402':
          $ref: '#/components/responses/PaymentRequired'
        '403':
          $ref: '#/components/responses/Forbidden'
        '422':
          $ref: '#/components/responses/BadRequest'
        '500':
          $ref: '#/components/responses/InternalServerError'
      security:
        - ApiKeyAuth: []
components:
  schemas:
    app__api__v1__analyses__schemas__AnalysisCreateRequest:
      properties:
        name:
          type: string
          maxLength: 255
          minLength: 1
          title: Name
        description:
          anyOf:
            - type: string
              maxLength: 1000
            - type: 'null'
          title: Description
        urls:
          items:
            type: string
          type: array
          minItems: 1
          title: Urls
          description: List of URLs to analyze
        structured_prompts:
          $ref: >-
            #/components/schemas/app__api__v1__prompts__schemas__StructuredPromptInput
        config:
          anyOf:
            - $ref: '#/components/schemas/AnalysisConfigInput'
            - type: 'null'
          description: Optional workflow configuration. If not provided, defaults are used.
      type: object
      required:
        - name
        - urls
        - structured_prompts
      title: AnalysisCreateRequest
      description: Request schema for creating analysis with URLs and structured prompts.
    app__api__v1__analyses__schemas__AnalysisCreateResponse:
      properties:
        response_type:
          type: string
          title: Response Type
          default: AnalysisCreateResponse
        data:
          $ref: >-
            #/components/schemas/app__api__v1__analyses__schemas__AnalysisCreateData
        links:
          items:
            $ref: '#/components/schemas/Link'
          type: array
          title: Links
          description: HATEOAS links related to this response (e.g., self, next, prev)
          default: []
          examples:
            - - href: /resource/{resource_id}
                method: GET
                rel: self
                title: Resource Details
              - href: /resource/{resource_id}/related
                method: GET
                rel: related
                title: Related Resources
      additionalProperties: false
      type: object
      required:
        - data
      title: AnalysisCreateResponse
      description: Basic analysis API response.
    app__api__v1__prompts__schemas__StructuredPromptInput:
      properties:
        ids:
          anyOf:
            - items:
                anyOf:
                  - type: string
                    pattern: ^prompt_[0-9a-hjkmnp-tv-z]{26}$
                    description: >-
                      TypeID with 'prompt' prefix. Format:
                      {prefix}_{base32_uuid7}. Example:
                      prompt_01h45ytscbebyvny4gc8cr8ma2
                    examples:
                      - prompt_01h45ytscbebyvny4gc8cr8ma2
                  - type: string
                    pattern: ^prompt_[0-9a-hjkmnp-tv-z]{26}@[0-9]+$
                    description: >-
                      Versioned prompt ID. Format: prompt_xxx@version. Includes
                      version suffix after @. Example:
                      prompt_01h45ytscbebyvny4gc8cr8ma2@1
                    examples:
                      - prompt_01h45ytscbebyvny4gc8cr8ma2@1
              type: array
            - type: 'null'
          title: Ids
          description: >-
            List of existing prompt refs. Unversioned (prompt_xxx) uses latest
            version. Versioned (prompt_xxx@3) pins to specific version.
        definitions:
          anyOf:
            - items:
                $ref: >-
                  #/components/schemas/app__api__v1__prompts__schemas__StructuredPromptCreateData
              type: array
            - type: 'null'
          title: Definitions
          description: List of structured prompt definitions to create
      type: object
      title: StructuredPromptInput
      description: Input for structured prompts - either refs or full definitions.
    AnalysisConfigInput:
      properties:
        normalize_input_to_domains:
          type: boolean
          title: Normalize Input To Domains
          description: >-
            If true (default), input strings are normalized to domains and
            multi-page exploration is used. If false, URLs are used as-is for
            single-page extraction.
          default: true
        max_pages:
          type: integer
          maximum: 50
          minimum: 1
          title: Max Pages
          description: >-
            Maximum number of pages to explore per domain when
            normalize_input_to_domains is true. Default is 5.
          default: 5
      additionalProperties: false
      type: object
      title: AnalysisConfigInput
      description: Analysis workflow configuration.
    app__api__v1__analyses__schemas__AnalysisCreateData:
      properties:
        id:
          type: string
          title: Id
        name:
          type: string
          title: Name
        description:
          anyOf:
            - type: string
            - type: 'null'
          title: Description
        owner:
          type: string
          title: Owner
        prompts:
          $ref: '#/components/schemas/PromptSummaryResponseData'
        urls:
          $ref: '#/components/schemas/UrlSummaryData'
        created_at:
          type: integer
          title: Created At
      type: object
      required:
        - id
        - name
        - owner
        - prompts
        - urls
        - created_at
      title: AnalysisCreateData
      description: Basic analysis creation data.
    Link:
      properties:
        href:
          type: string
          title: Href
          description: The URL of the linked resource
        rel:
          type: string
          title: Rel
          description: The relationship type (e.g., 'self', 'next')
        method:
          type: string
          title: Method
          description: The HTTP method (e.g., 'GET', 'POST')
          default: GET
        title:
          anyOf:
            - type: string
            - type: 'null'
          title: Title
          description: Optional human-readable title
      type: object
      required:
        - href
        - rel
      title: Link
    app__api__v1__prompts__schemas__StructuredPromptCreateData:
      properties:
        name:
          type: string
          maxLength: 255
          minLength: 1
          title: Name
          examples:
            - Company Summary Extractor
        description:
          anyOf:
            - type: string
              maxLength: 1000
            - type: 'null'
          title: Description
          examples:
            - >-
              Extracts what a company does and whether it is generalist or
              specialist.
        prompt:
          anyOf:
            - type: string
            - type: 'null'
          title: Prompt
          examples:
            - >-
              Given the page content, answer the questions according to the
              schema.
        response_schema:
          anyOf:
            - $ref: '#/components/schemas/app__api__v1__prompts__schemas__JSONSchema'
            - type: 'null'
          description: >-
            Draft-07 JSON Schema describing the structured response. If omitted,
            defaults to {"type":"string"}.
          examples:
            - draft_07:
                enum:
                  - generalist
                  - specialist
                type: string
            - draft_07:
                additionalProperties: false
                properties:
                  what_does_this_company_do:
                    type: string
                  offer_type:
                    enum:
                      - generalist
                      - specialist
                    type: string
                required:
                  - what_does_this_company_do
                  - offer_type
                type: object
      type: object
      required:
        - name
      title: StructuredPromptCreateData
      description: Full structured prompt definition for creation.
    PromptSummaryResponseData:
      properties:
        count:
          type: integer
          title: Count
        ids:
          items:
            $ref: '#/components/schemas/StructuredPromptVersionedRefData'
          type: array
          title: Ids
      type: object
      required:
        - count
        - ids
      title: PromptSummaryResponseData
      description: Prompt summary data for analysis creation response.
    UrlSummaryData:
      properties:
        count:
          type: integer
          title: Count
        urls:
          items:
            type: string
          type: array
          title: Urls
      type: object
      required:
        - count
        - urls
      title: UrlSummaryData
      description: URL summary data for analysis creation response.
    app__api__v1__prompts__schemas__JSONSchema:
      properties:
        draft_07:
          additionalProperties: true
          type: object
          title: Draft 07
          description: >-
            Draft-07 JSON Schema. Supports primitive schemas (e.g.,
            {"type":"string"}) or object schemas. If omitted, defaults to
            {"type":"string"}.
          examples:
            - enum:
                - generalist
                - specialist
              type: string
            - type: string
            - additionalProperties: false
              properties:
                what_does_this_company_do:
                  type: string
                offer_type:
                  enum:
                    - generalist
                    - specialist
                  type: string
              required:
                - what_does_this_company_do
                - offer_type
              type: object
            - type: boolean
            - maximum: 100
              minimum: 0
              type: number
      type: object
      required:
        - draft_07
      title: JSONSchema
      description: >-
        JSON Schema Draft-07 model for structured prompt responses.

        Supports both primitive schemas (e.g., {"type": "string"}) and object
        schemas.

        If omitted, defaults to {"type": "string"}.
    StructuredPromptVersionedRefData:
      properties:
        id:
          type: string
          pattern: ^prompt_[0-9a-hjkmnp-tv-z]{26}@[0-9]+$
          title: Id
          description: Versioned prompt ID (prompt_xxx@version)
          examples:
            - prompt_01h45ytscbebyvny4gc8cr8ma2@1
        idx:
          type: integer
          title: Idx
      type: object
      required:
        - id
        - idx
      title: StructuredPromptVersionedRefData
      description: |-
        Versioned prompt reference for analysis response.

        Shows which prompt version is linked to an analysis.
        Uses versioned ID format: prompt_xxx@version
  responses:
    BadRequest:
      description: Request Validation Error
      content:
        application/problem+json:
          schema:
            additionalProperties: false
            description: >-
              Error response wrapper for problem details that can be returned
              directly from FastAPI.
            properties:
              response_type:
                default: ErrorResponse
                description: Always 'ErrorResponse' for error responses
                examples:
                  - ErrorResponse
                title: Response Type
                type: string
              data:
                additionalProperties: true
                description: Problem detail for validation errors.
                properties:
                  title:
                    default: Request Validation Error
                    title: Title
                    type: string
                  status:
                    default: 422
                    title: Status
                    type: integer
                  detail:
                    default: Request validation failed
                    title: Detail
                    type: string
                  instance:
                    anyOf:
                      - type: string
                      - type: 'null'
                    default: null
                    description: >-
                      A URI reference that identifies the specific occurrence of
                      the problem
                    examples:
                      - https://urlyourequest.com/path?query=value
                    title: Instance
                title: ValidationError
                type: object
            required:
              - data
            title: ErrorResponse
            type: object
    Unauthorized:
      description: Unauthorized
      content:
        application/problem+json:
          schema:
            additionalProperties: false
            description: >-
              Error response wrapper for problem details that can be returned
              directly from FastAPI.
            properties:
              response_type:
                default: ErrorResponse
                description: Always 'ErrorResponse' for error responses
                examples:
                  - ErrorResponse
                title: Response Type
                type: string
              data:
                additionalProperties: true
                description: Problem detail for authentication errors.
                properties:
                  title:
                    default: Unauthorized
                    title: Title
                    type: string
                  status:
                    default: 401
                    title: Status
                    type: integer
                  detail:
                    default: Authentication required
                    title: Detail
                    type: string
                  instance:
                    anyOf:
                      - type: string
                      - type: 'null'
                    default: null
                    description: >-
                      A URI reference that identifies the specific occurrence of
                      the problem
                    examples:
                      - https://urlyourequest.com/path?query=value
                    title: Instance
                title: UnauthorizedError
                type: object
            required:
              - data
            title: ErrorResponse
            type: object
    PaymentRequired:
      description: Payment Required
      content:
        application/problem+json:
          schema:
            additionalProperties: false
            description: >-
              Error response wrapper for problem details that can be returned
              directly from FastAPI.
            properties:
              response_type:
                default: ErrorResponse
                description: Always 'ErrorResponse' for error responses
                examples:
                  - ErrorResponse
                title: Response Type
                type: string
              data:
                additionalProperties: true
                description: Problem detail for payment required errors.
                properties:
                  title:
                    default: Payment Required
                    title: Title
                    type: string
                  status:
                    default: 402
                    title: Status
                    type: integer
                  detail:
                    default: Payment required
                    title: Detail
                    type: string
                  instance:
                    anyOf:
                      - type: string
                      - type: 'null'
                    default: null
                    description: >-
                      A URI reference that identifies the specific occurrence of
                      the problem
                    examples:
                      - https://urlyourequest.com/path?query=value
                    title: Instance
                title: PaymentRequiredError
                type: object
            required:
              - data
            title: ErrorResponse
            type: object
    Forbidden:
      description: Forbidden
      content:
        application/problem+json:
          schema:
            additionalProperties: false
            description: >-
              Error response wrapper for problem details that can be returned
              directly from FastAPI.
            properties:
              response_type:
                default: ErrorResponse
                description: Always 'ErrorResponse' for error responses
                examples:
                  - ErrorResponse
                title: Response Type
                type: string
              data:
                additionalProperties: true
                description: Problem detail for authorization errors.
                properties:
                  title:
                    default: Forbidden
                    title: Title
                    type: string
                  status:
                    default: 403
                    title: Status
                    type: integer
                  detail:
                    default: Access forbidden
                    title: Detail
                    type: string
                  instance:
                    anyOf:
                      - type: string
                      - type: 'null'
                    default: null
                    description: >-
                      A URI reference that identifies the specific occurrence of
                      the problem
                    examples:
                      - https://urlyourequest.com/path?query=value
                    title: Instance
                title: ForbiddenError
                type: object
            required:
              - data
            title: ErrorResponse
            type: object
    InternalServerError:
      description: Internal Server Error
      content:
        application/problem+json:
          schema:
            additionalProperties: false
            description: >-
              Error response wrapper for problem details that can be returned
              directly from FastAPI.
            properties:
              response_type:
                default: ErrorResponse
                description: Always 'ErrorResponse' for error responses
                examples:
                  - ErrorResponse
                title: Response Type
                type: string
              data:
                additionalProperties: true
                description: Problem detail for internal server errors.
                properties:
                  title:
                    default: Internal Server Error
                    title: Title
                    type: string
                  status:
                    default: 500
                    title: Status
                    type: integer
                  detail:
                    default: Internal server error
                    title: Detail
                    type: string
                  instance:
                    anyOf:
                      - type: string
                      - type: 'null'
                    default: null
                    description: >-
                      A URI reference that identifies the specific occurrence of
                      the problem
                    examples:
                      - https://urlyourequest.com/path?query=value
                    title: Instance
                title: InternalServerError
                type: object
            required:
              - data
            title: ErrorResponse
            type: object
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: X-API-Key
      description: 'API Key for external integrations (format: greetincs_...)'

````