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

# Create a retained homology search

> Creates one durable search from scientific intent. Without Prefer, the server waits up to 2 seconds. Prefer: respond-async returns after durable acceptance; Prefer: wait=N waits up to N seconds. Returns 201 when terminal within that window and 202 otherwise. Transport preference never changes scientific execution.



## OpenAPI

````yaml /api-reference/openapi.json post /v1/homology
openapi: 3.1.0
info:
  description: >-
    Deterministic biological evidence primitives. Every response is the same
    envelope: ok, data, warnings, provenance.
  title: Rafflesia API
  version: 0.1.0
servers:
  - description: Production
    url: https://api.rafflesia.ai
security:
  - bearerAuth: []
paths:
  /v1/homology:
    post:
      tags:
        - Homology
      summary: Create a retained homology search
      description: >-
        Creates one durable search from scientific intent. Without Prefer, the
        server waits up to 2 seconds. Prefer: respond-async returns after
        durable acceptance; Prefer: wait=N waits up to N seconds. Returns 201
        when terminal within that window and 202 otherwise. Transport preference
        never changes scientific execution.
      operationId: homology_create
      parameters:
        - description: >-
            Retry identity for this semantic request. Reuse it after ambiguous
            failures.
          in: header
          name: Idempotency-Key
          required: true
          schema:
            description: >-
              Retry identity for this semantic request. Reuse it after ambiguous
              failures.
            type: string
        - description: >-
            Transport wait policy: respond-async, wait=N (0–60 seconds), or
            wait=N with respond-async fallback.
          in: header
          name: Prefer
          schema:
            description: >-
              Transport wait policy: respond-async, wait=N (0–60 seconds), or
              wait=N with respond-async fallback.
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateHomologySearchRequest'
        required: true
      responses:
        '201':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/EnvelopeHomologySearch'
          description: Created
          headers:
            Location:
              schema:
                type: string
            Preference-Applied:
              schema:
                type: string
            Rafflesia-Contract-Digest:
              schema:
                type: string
            Rafflesia-Version:
              schema:
                type: string
            X-Request-ID:
              schema:
                type: string
        '202':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/EnvelopeHomologySearch'
          description: Accepted
          headers:
            Location:
              schema:
                type: string
            Preference-Applied:
              schema:
                type: string
            Rafflesia-Contract-Digest:
              schema:
                type: string
            Rafflesia-Version:
              schema:
                type: string
            X-Request-ID:
              schema:
                type: string
        default:
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ErrorModel'
          description: Error
components:
  schemas:
    CreateHomologySearchRequest:
      additionalProperties: false
      properties:
        $schema:
          description: A URL to the JSON Schema for this object.
          examples:
            - https://example.com/schemas/CreateHomologySearchRequest.json
          format: uri
          readOnly: true
          type: string
        constraints:
          $ref: '#/components/schemas/HomologySearchConstraints'
        policy:
          $ref: '#/components/schemas/HomologySearchPolicySelector'
        query:
          $ref: '#/components/schemas/HomologyQuery'
        results:
          $ref: '#/components/schemas/HomologySearchResultsRequest'
        target:
          $ref: '#/components/schemas/HomologySearchTarget'
      required:
        - query
        - target
        - results
      type: object
    EnvelopeHomologySearch:
      additionalProperties: false
      properties:
        $schema:
          description: A URL to the JSON Schema for this object.
          examples:
            - https://example.com/schemas/EnvelopeHomologySearch.json
          format: uri
          readOnly: true
          type: string
        data:
          $ref: '#/components/schemas/HomologySearch'
          description: Operation result data.
        error:
          $ref: '#/components/schemas/APIError'
          description: Structured error information.
        evidence:
          $ref: '#/components/schemas/EvidenceSummary'
          description: Mechanical evidence summary for agent inspection and chaining.
        ok:
          description: Whether the operation succeeded.
          type: boolean
        provenance:
          $ref: '#/components/schemas/Provenance'
          description: Execution provenance.
        warnings:
          description: Non-fatal warnings.
          items:
            $ref: '#/components/schemas/Warning'
          type:
            - array
            - 'null'
      required:
        - ok
        - warnings
        - provenance
      type: object
    ErrorModel:
      additionalProperties: false
      properties:
        $schema:
          description: A URL to the JSON Schema for this object.
          examples:
            - https://example.com/schemas/ErrorModel.json
          format: uri
          readOnly: true
          type: string
        detail:
          description: >-
            A human-readable explanation specific to this occurrence of the
            problem.
          examples:
            - Property foo is required but is missing.
          type: string
        errors:
          description: Optional list of individual error details
          items:
            $ref: '#/components/schemas/ErrorDetail'
          type:
            - array
            - 'null'
        instance:
          description: >-
            A URI reference that identifies the specific occurrence of the
            problem.
          examples:
            - https://example.com/error-log/abc123
          format: uri
          type: string
        status:
          description: HTTP status code
          examples:
            - 400
          format: int64
          type: integer
        title:
          description: >-
            A short, human-readable summary of the problem type. This value
            should not change between occurrences of the error.
          examples:
            - Bad Request
          type: string
        type:
          default: about:blank
          description: A URI reference to human-readable documentation for the error.
          examples:
            - https://example.com/errors/example
          format: uri
          type: string
      type: object
    HomologySearchConstraints:
      additionalProperties: false
      properties:
        deadline_ms:
          format: int64
          minimum: 1
          type: integer
        max_billable_units:
          format: int64
          minimum: 1
          type: integer
      type: object
    HomologySearchPolicySelector:
      additionalProperties: false
      properties:
        id:
          description: >-
            Exact immutable Tomato search-policy identity. Omit to use the
            release's recorded default policy.
          type: string
      type: object
    HomologyQuery:
      additionalProperties: false
      properties:
        kind:
          description: Query kind.
          enum:
            - protein_sequence
          type: string
        sequence:
          description: Raw amino-acid sequence text.
          type: string
      required:
        - kind
        - sequence
      type: object
    HomologySearchResultsRequest:
      additionalProperties: false
      properties:
        evidence:
          enum:
            - candidate_measurement
            - pairwise_sequence_alignment
          type: string
        max_results:
          format: int64
          maximum: 10000
          minimum: 1
          type: integer
        significance_requirement:
          default: not_requested
          enum:
            - not_requested
            - if_available
            - required
          type: string
        unit:
          default: target
          enum:
            - target
          type: string
      required:
        - unit
        - evidence
        - max_results
        - significance_requirement
      type: object
    HomologySearchTarget:
      description: >-
        Exact target population, expressed either inline or by immutable
        reusable identity.
      oneOf:
        - $ref: '#/components/schemas/HomologyInlineSearchTarget'
        - $ref: '#/components/schemas/HomologyReusableTargetSpace'
    HomologySearch:
      additionalProperties: false
      properties:
        created_at:
          type: string
        failure:
          $ref: '#/components/schemas/HomologySearchFailure'
        id:
          type: string
        object:
          type: string
        policy_id:
          type: string
        query:
          $ref: '#/components/schemas/HomologySearchQuerySummary'
        receipt:
          $ref: '#/components/schemas/HomologySearchReceipt'
        result_set:
          $ref: '#/components/schemas/HomologySearchResultSet'
        results:
          $ref: '#/components/schemas/HomologySearchResultsRequest'
        specification_sha256:
          type: string
        status:
          enum:
            - queued
            - running
            - succeeded
            - failed
          type: string
        target_space:
          $ref: '#/components/schemas/HomologySearchTargetSpace'
          description: >-
            Authoritative searched target population. For filtered async
            searches this is absent until Tomato has compiled immutable
            eligibility.
        warnings:
          items:
            $ref: '#/components/schemas/Warning'
          type:
            - array
            - 'null'
      required:
        - id
        - object
        - created_at
        - status
        - query
        - policy_id
        - results
        - specification_sha256
        - receipt
        - warnings
      type: object
    APIError:
      additionalProperties: false
      properties:
        code:
          description: Stable specific error code.
          type: string
        details:
          additionalProperties: {}
          description: Additional structured error details.
          type: object
        doc_url:
          description: Stable documentation URL for this error code.
          type: string
        message:
          description: Human-readable error message.
          type: string
        param:
          description: Request field responsible for the error when known.
          type: string
        type:
          description: Stable coarse error category.
          enum:
            - invalid_request_error
            - resource_missing
            - conflict_error
            - rate_limit_error
            - authentication_error
            - permission_error
            - billing_error
            - api_error
          type: string
      required:
        - type
        - code
        - message
        - doc_url
      type: object
    EvidenceSummary:
      additionalProperties: false
      properties:
        duration_ms:
          description: >-
            Primary elapsed duration in milliseconds when the response exposes
            one.
          format: int64
          type: integer
        input_refs:
          description: >-
            Input references detected from request fields such as object_id,
            structure_id, target_id, and sequence_id.
          items:
            type: string
          type:
            - array
            - 'null'
        object_refs:
          description: Object ids or object refs visible in the response/provenance.
          items:
            type: string
          type:
            - array
            - 'null'
        output_refs:
          description: Output references detected from response data and generated objects.
          items:
            type: string
          type:
            - array
            - 'null'
        row_count:
          description: >-
            Primary row count or returned row count when the response exposes
            one.
          format: int64
          type: integer
        warnings_count:
          description: Number of non-fatal warnings in the envelope.
          format: int64
          type: integer
      required:
        - warnings_count
      type: object
    Provenance:
      additionalProperties: false
      properties:
        cache_hit:
          description: Whether cached output was reused.
          type: boolean
        created_at:
          description: UTC timestamp.
          type: string
        database_snapshots:
          description: Database snapshots used.
          items:
            $ref: '#/components/schemas/DatabaseSnapshot'
          type:
            - array
            - 'null'
        generated_object_ids:
          description: Object ids created by the operation.
          items:
            type: string
          type:
            - array
            - 'null'
        input_hash:
          description: SHA-256 hash of canonical request input.
          type: string
        operation:
          description: Primitive operation id.
          type: string
        parameters_hash:
          description: SHA-256 hash of parameters.
          type: string
        request_id:
          description: Unique request identifier.
          type: string
        server_version:
          description: Server version.
          type: string
        tool_versions:
          description: Tool versions used.
          items:
            $ref: '#/components/schemas/ToolVersion'
          type:
            - array
            - 'null'
      required:
        - request_id
        - operation
        - created_at
        - server_version
      type: object
    Warning:
      additionalProperties: false
      properties:
        code:
          description: Stable warning code.
          type: string
        details:
          additionalProperties: {}
          description: Additional structured warning details.
          type: object
        message:
          description: Human-readable warning message.
          type: string
      required:
        - code
        - message
      type: object
    ErrorDetail:
      additionalProperties: false
      properties:
        location:
          description: >-
            Where the error occurred, e.g. 'body.items[3].tags' or
            'path.thing-id'
          type: string
        message:
          description: Error message text
          type: string
        value:
          description: The value at the given location
      type: object
    HomologyInlineSearchTarget:
      additionalProperties: false
      properties:
        database_release_id:
          description: Exact immutable Tomato release identity.
          minLength: 1
          type: string
        filter:
          $ref: '#/components/schemas/HomologyDocumentFilter'
      required:
        - database_release_id
      type: object
    HomologyReusableTargetSpace:
      additionalProperties: false
      properties:
        calibration_id:
          description: Optional qualified calibration bound to this target space.
          pattern: ^cal_[0-9a-f]{64}$
          type: string
        target_space_id:
          description: Opaque immutable reusable target-space identity.
          pattern: ^htsp_[0-9a-f]{64}$
          type: string
      required:
        - target_space_id
      type: object
    HomologySearchFailure:
      additionalProperties: false
      properties:
        code:
          type: string
        detail:
          type: string
        is_retryable:
          type: boolean
      required:
        - code
        - detail
        - is_retryable
      type: object
    HomologySearchQuerySummary:
      additionalProperties: false
      properties:
        kind:
          type: string
        normalization_id:
          type: string
        normalized_length:
          format: int64
          type: integer
        retention:
          type: string
        sha256:
          type: string
      required:
        - kind
        - normalized_length
        - normalization_id
        - sha256
        - retention
      type: object
    HomologySearchReceipt:
      additionalProperties: false
      properties:
        calibration_id:
          type: string
        canonical_filter_sha256:
          type: string
        corpus_snapshot_id:
          type: string
        database_release_id:
          type: string
        engine:
          type: string
        filter_schema_id:
          type: string
        is_deterministic:
          type: boolean
        is_exhaustive:
          type: boolean
        is_policy_complete:
          type: boolean
        job_id:
          type: string
        query_compilation_id:
          type: string
        search_policy_id:
          type: string
        semantic_profile_id:
          type: string
        submission_id:
          type: string
        target_space_id:
          type: string
      required:
        - engine
        - database_release_id
        - corpus_snapshot_id
        - semantic_profile_id
        - search_policy_id
        - is_policy_complete
        - is_exhaustive
        - is_deterministic
      type: object
    HomologySearchResultSet:
      additionalProperties: false
      properties:
        canonical_result_id:
          type: string
        count:
          format: int64
          type: integer
        is_result_limit_reached:
          type: boolean
        object:
          type: string
        sha256:
          type: string
        url:
          type: string
      required:
        - object
        - url
        - count
        - sha256
        - canonical_result_id
        - is_result_limit_reached
      type: object
    HomologySearchTargetSpace:
      additionalProperties: false
      properties:
        canonical_filter_sha256:
          type: string
        eligible_record_count:
          format: int64
          type: integer
        eligible_residue_count:
          format: int64
          type: integer
        filter_schema_id:
          type: string
        id:
          description: Opaque immutable identity of the exact target population searched.
          type: string
        is_filtered:
          type: boolean
        total_record_count:
          format: int64
          type: integer
        unknown_record_count:
          format: int64
          type: integer
      required:
        - id
        - is_filtered
        - total_record_count
        - eligible_record_count
        - eligible_residue_count
        - unknown_record_count
      type: object
    DatabaseSnapshot:
      additionalProperties: false
      properties:
        digest:
          type: string
        kind:
          type: string
        name:
          type: string
        version:
          type: string
      required:
        - name
        - version
      type: object
    ToolVersion:
      additionalProperties: false
      properties:
        name:
          type: string
        path:
          type: string
        version:
          type: string
      required:
        - name
        - version
      type: object
    HomologyDocumentFilter:
      additionalProperties: false
      description: >-
        Recursive metadata predicate defining the eligible target population.
        Field/operator compatibility and limits come from the immutable filter
        schema for the selected release. Missing fields use strong Kleene logic;
        only true records are eligible.
      discriminator:
        propertyName: op
      oneOf:
        - $ref: '#/components/schemas/HomologyFilterAnd'
        - $ref: '#/components/schemas/HomologyFilterOr'
        - $ref: '#/components/schemas/HomologyFilterNot'
        - $ref: '#/components/schemas/HomologyFilterEq'
        - $ref: '#/components/schemas/HomologyFilterIn'
        - $ref: '#/components/schemas/HomologyFilterLt'
        - $ref: '#/components/schemas/HomologyFilterLte'
        - $ref: '#/components/schemas/HomologyFilterGt'
        - $ref: '#/components/schemas/HomologyFilterGte'
        - $ref: '#/components/schemas/HomologyFilterContains'
        - $ref: '#/components/schemas/HomologyFilterContainsAny'
        - $ref: '#/components/schemas/HomologyFilterContainsAll'
        - $ref: '#/components/schemas/HomologyFilterExists'
      properties:
        field:
          maxLength: 256
          pattern: ^[a-z0-9_]+$
          type: string
        filter:
          $ref: '#/components/schemas/HomologyDocumentFilter'
        filters:
          items:
            $ref: '#/components/schemas/HomologyDocumentFilter'
          maxItems: 256
          minItems: 1
          type: array
        op:
          enum:
            - and
            - or
            - not
            - eq
            - in
            - lt
            - lte
            - gt
            - gte
            - contains
            - contains_any
            - contains_all
            - exists
          type: string
        value:
          oneOf:
            - maxLength: 16384
              type: string
            - type: integer
            - type: boolean
        values:
          items:
            oneOf:
              - maxLength: 16384
                type: string
              - type: integer
              - type: boolean
          maxItems: 4096
          minItems: 1
          type: array
      required:
        - op
      type: object
    HomologyFilterAnd:
      additionalProperties: false
      properties:
        filters:
          items:
            $ref: '#/components/schemas/HomologyDocumentFilter'
          maxItems: 256
          minItems: 1
          type: array
        op:
          enum:
            - and
          type: string
      required:
        - op
        - filters
      type: object
    HomologyFilterOr:
      additionalProperties: false
      properties:
        filters:
          items:
            $ref: '#/components/schemas/HomologyDocumentFilter'
          maxItems: 256
          minItems: 1
          type: array
        op:
          enum:
            - or
          type: string
      required:
        - op
        - filters
      type: object
    HomologyFilterNot:
      additionalProperties: false
      properties:
        filter:
          $ref: '#/components/schemas/HomologyDocumentFilter'
        op:
          enum:
            - not
          type: string
      required:
        - op
        - filter
      type: object
    HomologyFilterEq:
      additionalProperties: false
      properties:
        field:
          maxLength: 256
          not:
            enum:
              - id
          pattern: ^[a-z0-9_]+$
          type: string
        op:
          enum:
            - eq
          type: string
        value:
          oneOf:
            - maxLength: 16384
              type: string
            - type: integer
            - type: boolean
      required:
        - op
        - field
        - value
      type: object
    HomologyFilterIn:
      additionalProperties: false
      properties:
        field:
          maxLength: 256
          not:
            enum:
              - id
          pattern: ^[a-z0-9_]+$
          type: string
        op:
          enum:
            - in
          type: string
        values:
          items:
            oneOf:
              - maxLength: 16384
                type: string
              - type: integer
              - type: boolean
          maxItems: 4096
          minItems: 1
          type: array
      required:
        - op
        - field
        - values
      type: object
    HomologyFilterLt:
      additionalProperties: false
      properties:
        field:
          maxLength: 256
          not:
            enum:
              - id
          pattern: ^[a-z0-9_]+$
          type: string
        op:
          enum:
            - lt
          type: string
        value:
          type: integer
      required:
        - op
        - field
        - value
      type: object
    HomologyFilterLte:
      additionalProperties: false
      properties:
        field:
          maxLength: 256
          not:
            enum:
              - id
          pattern: ^[a-z0-9_]+$
          type: string
        op:
          enum:
            - lte
          type: string
        value:
          type: integer
      required:
        - op
        - field
        - value
      type: object
    HomologyFilterGt:
      additionalProperties: false
      properties:
        field:
          maxLength: 256
          not:
            enum:
              - id
          pattern: ^[a-z0-9_]+$
          type: string
        op:
          enum:
            - gt
          type: string
        value:
          type: integer
      required:
        - op
        - field
        - value
      type: object
    HomologyFilterGte:
      additionalProperties: false
      properties:
        field:
          maxLength: 256
          not:
            enum:
              - id
          pattern: ^[a-z0-9_]+$
          type: string
        op:
          enum:
            - gte
          type: string
        value:
          type: integer
      required:
        - op
        - field
        - value
      type: object
    HomologyFilterContains:
      additionalProperties: false
      properties:
        field:
          maxLength: 256
          not:
            enum:
              - id
          pattern: ^[a-z0-9_]+$
          type: string
        op:
          enum:
            - contains
          type: string
        value:
          maxLength: 16384
          type: string
      required:
        - op
        - field
        - value
      type: object
    HomologyFilterContainsAny:
      additionalProperties: false
      properties:
        field:
          maxLength: 256
          not:
            enum:
              - id
          pattern: ^[a-z0-9_]+$
          type: string
        op:
          enum:
            - contains_any
          type: string
        values:
          items:
            maxLength: 16384
            type: string
          maxItems: 4096
          minItems: 1
          type: array
      required:
        - op
        - field
        - values
      type: object
    HomologyFilterContainsAll:
      additionalProperties: false
      properties:
        field:
          maxLength: 256
          not:
            enum:
              - id
          pattern: ^[a-z0-9_]+$
          type: string
        op:
          enum:
            - contains_all
          type: string
        values:
          items:
            maxLength: 16384
            type: string
          maxItems: 4096
          minItems: 1
          type: array
      required:
        - op
        - field
        - values
      type: object
    HomologyFilterExists:
      additionalProperties: false
      properties:
        field:
          maxLength: 256
          not:
            enum:
              - id
          pattern: ^[a-z0-9_]+$
          type: string
        op:
          enum:
            - exists
          type: string
        value:
          type: boolean
      required:
        - op
        - field
        - value
      type: object
  securitySchemes:
    bearerAuth:
      description: 'A Rafflesia API key, sent as `Authorization: Bearer <key>`.'
      scheme: bearer
      type: http

````