> ## 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 join keys

> For a caller about to write a JOIN: name the tables and get every join
among them as a predicate ready to paste into `ON`, measured on the data
rather than guessed from column names.

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/join_keys/{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/join_keys/{database}:
    post:
      tags:
        - Agent
      summary: Find join keys
      description: >-
        For a caller about to write a JOIN: name the tables and get every join

        among them as a predicate ready to paste into `ON`, measured on the data

        rather than guessed from column names.


        Preview: this route may change between releases. It needs the agent APIs
        enabled on your account, and answers 403 until they are.
      operationId: join_keys
      parameters:
        - name: database
          in: path
          description: Target database.
          required: true
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/JoinKeysRequest'
            example:
              tables:
                - logs
                - issues
        required: true
      responses:
        '200':
          description: >-
            Every join among the named tables, each as the two sides and the
            `ON` clause to write (`logs.instance_id = issues.instance_id`,
            `split_part(code.path, '/', 1) = issues.project`), with the share of
            the referencing side's values found on the other side and whether a
            statement counted it. The first call over a pair counts its joins on
            the data (the estimates from samples of the tables' values, and the
            joins the deployment's model proposes from the two cards, each
            measured by a statement) and records the verdict; later calls over
            the pair read it back while both tables stand as they were counted.
            `pairs` is the pairs the tables make, `counted` how many this call
            measured, `model_tokens` the tokens the proposing model used, the
            count this call's inference was billed on. What the inference was
            billed is in the `x-infino-inference-nanodollars` response header, 0
            when no model ran.
          headers:
            x-infino-inference-nanodollars:
              schema:
                type: integer
                format: int64
                minimum: 0
              description: >-
                What this call's inference was billed, in billionths of a US
                dollar; 0 when no model ran.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/JoinKeysResponse'
              example:
                joins:
                  - from_table: logs
                    from_column: instance_id
                    to_table: issues
                    to_column: instance_id
                    predicate: logs.instance_id = issues.instance_id
                    inclusion: 0.98
                    coverage: 0.41
                    verified: true
                pairs: 1
                counted: 1
                model_tokens: 1840
        '400':
          description: >-
            Invalid request body, fewer than two distinct tables or more than
            eight, or a table or 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 does not exist, or a named table has no card yet: it
            has not been described since it was created, or does not exist.
        '410':
          description: The database is being purged.
        '502':
          description: >-
            The service could not read the answer computed for this request.
            Transient: retry.
        '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:
    JoinKeysRequest:
      type: object
      description: |-
        `POST /v1/join_keys/{database}`: the tables a statement will join. An
        unknown field is refused.
      required:
        - tables
      properties:
        tables:
          type: array
          items:
            type: string
          description: |-
            The tables the statement will span: two to eight distinct names,
            each a table with a card. A name given twice counts once.
      additionalProperties: false
    JoinKeysResponse:
      type: object
      description: The keys among the named tables.
      required:
        - joins
        - pairs
        - counted
        - model_tokens
      properties:
        counted:
          type: integer
          description: |-
            Pairs counted on the data by this call; the rest were read back from
            an earlier count.
          minimum: 0
        joins:
          type: array
          items:
            $ref: '#/components/schemas/JoinKey'
          description: |-
            Every join among the tables, each once, referencing table first.
            Empty when no column of one table holds another's values.
        model_tokens:
          type: integer
          format: int64
          description: |-
            Tokens the proposing model read and wrote on this call, the count
            this call's inference was billed on; 0 when no model ran.
          minimum: 0
        pairs:
          type: integer
          description: Pairs of tables the request spans.
          minimum: 0
    JoinKey:
      type: object
      description: One join between two of the named tables, ready to write.
      required:
        - from_table
        - from_column
        - to_table
        - to_column
        - predicate
        - inclusion
        - coverage
        - verified
      properties:
        coverage:
          type: number
          format: double
          description: |-
            Share of the referenced side's distinct values the referencing side
            uses, 0 to 1.
        from_column:
          type: string
          description: The referencing side's column.
        from_expression:
          type:
            - string
            - 'null'
          description: |-
            The SQL over `from_column` the values meet through, with `{column}`
            in place of the column; absent when they match as they are.
        from_table:
          type: string
          description: |-
            The referencing side: the table whose column's values are found in
            the other.
        inclusion:
          type: number
          format: double
          description: |-
            Share of the referencing side's distinct values found on the
            referenced side, 0 to 1.
        predicate:
          type: string
          description: |-
            The `ON` clause, the tables as qualifiers:
            `logs.instance_id = issues.instance_id`, or
            `split_part(code.path, '/', 1) = issues.project`. Alias a search's
            rows as the table and it pastes as it stands.
        to_column:
          type: string
          description: The referenced side's column.
        to_expression:
          type:
            - string
            - 'null'
          description: |-
            The SQL over `to_column` the values meet through, with `{column}` in
            place of the column; absent when they match as they are.
        to_table:
          type: string
          description: 'The referenced side: the table whose column holds the values.'
        verified:
          type: boolean
          description: |-
            Whether a statement counted the shares on the data (true), or they
            were estimated from samples of the two columns' values (false).
  securitySchemes:
    api_key:
      type: http
      scheme: bearer

````

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