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

# Find lines

> A search at line grain: every line of the column's text that holds the
literal, with the columns that place it, counted over every match.

Preview: this route may change between releases. It needs the agent APIs enabled on your account, and answers 403 until they are.



## OpenAPI

````yaml /api-reference/openapi.json post /v1/find/{database}
openapi: 3.1.0
info:
  title: Infino API
  description: >-
    The Infino hosted data-plane API: per-database table operations — create,
    ingest, search, and SQL.
  version: 0.1.0
servers:
  - url: https://api.platform.infino.ws
    description: Infino Cloud
security:
  - api_key: []
tags:
  - name: Databases
    description: Create, list, and delete the databases in your account.
  - name: Tables
    description: Create, drop, and list tables, and describe a table's schema.
  - name: Rows
    description: Append, update, and delete rows.
  - name: Search
    description: BM25, vector, and hybrid search, token and exact match, count, and SQL.
  - name: Agent
    description: >-
      Preview routes for agents: table cards, join keys, line search, result
      checks, graph lookups, and the retrieval sub-agent. They need the agent
      APIs enabled on your account.
  - name: Hydrate
    description: >-
      Preview routes for loading a dataset: start a load of files from object
      storage into a table, follow it, cancel or clear it, and run a sync pass.
paths:
  /v1/find/{database}:
    post:
      tags:
        - Agent
      summary: Find lines
      description: >-
        A search at line grain: every line of the column's text that holds the

        literal, with the columns that place it, counted over every match.


        Preview: this route may change between releases. It needs the agent APIs
        enabled on your account, and answers 403 until they are.
      operationId: find
      parameters:
        - name: database
          in: path
          description: Target database.
          required: true
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/FindRequest'
            example:
              table_name: code
              field_name: content
              literal: retry_budget
              projection:
                - path
                - start_line
              group_by: path
              line_base: start_line
              limit: 2
        required: true
      responses:
        '200':
          description: >-
            The matching lines as JSON: `total`, `truncated`, `lines` (each with
            the projected columns, `{}` when none were named, its `line_index`
            within the row's text and the line, cut to an excerpt around the
            literal), `groups_total` (distinct `group_by` values among the
            matches; 0 when none was named) and, when a `group_by` column was
            named and lines matched, `groups` with the line count per value
            (most lines first, at most 500 groups). At most `limit` lines (500
            by default and at most; 0 for the counts alone); the total and the
            group counts cover every match.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/FindResult'
              example:
                total: 3
                truncated: true
                lines:
                  - columns:
                      path: src/client.rs
                      start_line: 40
                    line_index: 3
                    file_line: 43
                    line: '    let retry_budget = config.retry_budget;'
                  - columns:
                      path: src/client.rs
                      start_line: 40
                    line_index: 9
                    file_line: 49
                    line: '    if attempts > retry_budget {'
                groups_total: 2
                groups:
                  - value: src/client.rs
                    lines: 2
                  - value: src/config.rs
                    lines: 1
        '400':
          description: >-
            Invalid request body; a literal with no searchable term (it needs at
            least one letter or digit) or one that spans lines; the searched
            column named as a projected or group column; or a database name that
            is not an identifier.
        '401':
          description: Missing or invalid API key.
        '402':
          description: >-
            The account is suspended for non-payment, or its free period has
            ended.
        '403':
          description: >-
            The agent APIs are not enabled for this account, or the API key
            lacks read access to this database.
        '404':
          description: The database or the table does not exist.
        '410':
          description: The database is being purged.
        '501':
          description: >-
            The request asked for a `rerank` and this deployment runs no grading
            model. Send the request without `rerank`.
        '503':
          description: >-
            The database is still activating, or no capacity is free to serve
            it. Transient: retry after the `Retry-After` interval.
      security:
        - api_key: []
components:
  schemas:
    FindRequest:
      type: object
      description: |-
        `POST /v1/find/{database}`: the lines of an indexed text column that
        contain a literal. An unknown field is refused.
      required:
        - table_name
        - field_name
        - literal
      properties:
        field_name:
          type: string
          description: The full-text-indexed column searched.
        group_by:
          type:
            - string
            - 'null'
          description: >-
            A column other than `field_name` whose distinct values group the
            line

            counts (lines per file when it names the path column). Counted over

            every matching line of every row, not only the lines returned; the

            groups with the most lines come first, at most 500 of them, and

            `groups_total` says how many there were.
        ignore_case:
          type: boolean
          description: Match regardless of letter case.
        limit:
          type:
            - integer
            - 'null'
          description: |-
            Lines returned at most: 500 when omitted, and never more than 500;
            0 returns the counts alone. The total is reported whatever the
            limit.
          minimum: 0
        line_base:
          type:
            - string
            - 'null'
          description: >-
            An integer column holding each row's first line in its source (a

            chunked file's `start_line`), for a table whose rows overlap: a line

            two rows both hold is then counted once, at `line_base +
            line_index`,

            before the total, the groups and the limit. Omitted, every row's

            lines count.
        literal:
          type: string
          description: >-
            The text to find, as a substring of one line of `field_name`. It
            must

            hold at least one letter or digit and no newline, and it is found

            only where it starts and ends at word boundaries of the column's
            text

            (`env::var` is found, `nv::va` is not). The full-text grammar

            characters (`"`, `+`, `-`) are read as punctuation.
        projection:
          type: array
          items:
            type: string
          description: |-
            Columns returned beside each line, so the caller can place it: a
            code table asks for `path` and `start_line` and adds the line's
            `line_index`. Omitted, each line's `columns` is `{}` and lines order
            by `line_index` alone; name at least one column to place or tell
            apart lines from different rows. `field_name` itself is refused: the
            line is already returned.
        rerank:
          oneOf:
            - type: 'null'
            - $ref: '#/components/schemas/Rerank'
              description: >-
                Rerank the matched lines for a question with the deployment's

                grading model and return the top `k`; the total and the group
                counts

                still cover every match. Refused with 501 on a deployment that
                runs

                no grading model.
        table_name:
          type: string
          description: The table searched.
      additionalProperties: false
    FindResult:
      type: object
      description: What a find found.
      required:
        - total
        - truncated
        - lines
        - groups_total
      properties:
        groups:
          type: array
          items:
            $ref: '#/components/schemas/FoundGroup'
          description: >-
            Per-group counts, absent when no `group_by` column was named or when

            nothing matched: the groups with the most lines first, then by
            value,

            at most the group cap of them.
        groups_total:
          type: integer
          description: |-
            Distinct values of the `group_by` column among the matches, before
            the group cap; 0 when no column was named.
          minimum: 0
        lines:
          type: array
          items:
            $ref: '#/components/schemas/FoundLine'
          description: |-
            The first `limit` matched lines, ordered by the projected values
            (numbers numerically), then by where the line sits in its source,
            then by `line_index` within the row, then by the line text. So the
            lines of one source come back in the order they appear in it, and a
            truncated answer is its first `limit` lines rather than an arbitrary
            `limit` of them.
        total:
          type: integer
          description: Matched lines in all, before the limit.
          minimum: 0
        truncated:
          type: boolean
          description: Whether `lines` holds fewer than `total`.
    Rerank:
      type: object
      description: |-
        Ask for a query's rows to be reranked for a question by the deployment's
        grading model before they come back: each row is scored against the
        question where the rows are, and the best come back first.
      required:
        - question
      properties:
        k:
          type:
            - integer
            - 'null'
          description: |-
            Rows to return, best first. A search fetches a wider pool of
            candidates to score (or its own `k`, if wider) and returns this
            many; absent, the query's own `k`, or every row of a query that
            names none.
          minimum: 0
        question:
          type: string
          description: |-
            The question the rows are meant to answer, in the words it was
            asked.
      additionalProperties: false
    FoundGroup:
      type: object
      description: Lines per distinct value of the `group_by` column.
      required:
        - value
        - lines
      properties:
        lines:
          type: integer
          description: Matched lines in the group, counted over every match.
          minimum: 0
        value:
          description: |-
            The group's value of the `group_by` column, as the column holds it:
            a string, a number, a boolean or null. The engine's row id comes as
            its digits in a string, since a JSON number cannot carry it exactly.
    FoundLine:
      type: object
      description: One matched line.
      required:
        - columns
        - line_index
        - line
      properties:
        columns:
          type: object
          description: The projected columns' values, by name.
        file_line:
          type:
            - integer
            - 'null'
          format: int64
          description: |-
            The line's own number in the source, when the rows carry one: the
            row's first line (the request's `line_base` column) plus
            `line_index`. The number to cite. Absent when no column places the
            row.
        line:
          type: string
          description: |-
            The line, cut to an excerpt around the first occurrence of the
            literal when it is long; a cut edge is marked with `…`.
        line_index:
          type: integer
          description: The line's position within its row's text, counted from 0.
          minimum: 0
  securitySchemes:
    api_key:
      type: http
      scheme: bearer

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.