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

# Search labels

<Note>This endpoint is in beta and is subject to change.</Note>


## OpenAPI

````yaml post /v1/workbooks/search/labels
openapi: 3.1.0
info:
  title: GRID API
  summary: Spreadsheets run the world. Now you can run spreadsheets.
  description: >-
    GRID's API transforms spreadsheets into powerful, programmable APIs. Our
    platform supports seamless integration of spreadsheet data into your
    applications, supporting dynamic interactions with spreadsheets, including
    real-time data querying with ephemeral updates.
  version: 1.0.0
servers:
  - url: https://api.grid.is
security: []
tags:
  - name: workbooks
    description: Interact with workbooks and their data
paths:
  /v1/workbooks/search/labels:
    post:
      tags:
        - workbooks
      summary: Search data labels across all spreadsheets uploaded to an account
      operationId: search_labels
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/LabelSearchRequest'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/LabelSearchResponse'
        '400':
          description: Error returned when you make a bad request
          content:
            application/json:
              example:
                error_code: invalid_json
                error_message: Bad request
                error_details: RequestJsonParsingFailed
        '403':
          description: Error returned when you don't have permission to query a workbook
          content:
            application/json:
              example:
                error_message: Forbidden
                error_details: Only API keys can access the workbook engine API
        '429':
          description: Error returned when you exceed your API rate limit
          content:
            application/json:
              example:
                error_code: rate_limit_exceeded
                error_message: Rate limit exceeded
                error_details: 'Retry after: 60'
      security:
        - apiKey: []
      x-codeSamples:
        - lang: JavaScript
          source: >-
            import Grid from '@grid-is/api';


            const client = new Grid({
              apiKey: 'My API Key',
            });


            const response = await client.beta.searchLabels({ query: 'profit'
            });


            console.log(response.results);
        - lang: Python
          source: |-
            from grid_api import Grid

            client = Grid(
                api_key="My API Key",
            )
            response = client.beta.search_labels(
                query="profit",
            )
            print(response.results)
        - lang: Java
          source: |-
            package is.grid.api.example;

            import is.grid.api.client.GridClient;
            import is.grid.api.client.okhttp.GridOkHttpClient;
            import is.grid.api.models.beta.BetaSearchLabelsParams;
            import is.grid.api.models.beta.BetaSearchLabelsResponse;

            public final class Main {
                private Main() {}

                public static void main(String[] args) {
                    GridClient client = GridOkHttpClient.fromEnv();

                    BetaSearchLabelsParams params = BetaSearchLabelsParams.builder()
                        .query("profit")
                        .build();
                    BetaSearchLabelsResponse response = client.beta().searchLabels(params);
                }
            }
components:
  schemas:
    LabelSearchRequest:
      properties:
        query:
          type: string
          title: Query
          examples:
            - profit
            - annual revenue
            - subscription rate
        max_results:
          anyOf:
            - type: integer
            - type: 'null'
          title: Max Results
          description: Maximum number of workbooks to return results for
          examples:
            - 10
        max_labels:
          anyOf:
            - type: integer
            - type: 'null'
          title: Max Labels
          description: Maximum number of labels to return per workbook
          examples:
            - 20
      type: object
      required:
        - query
      title: LabelSearchRequest
      description: |-
        Define the data labels you want to search for, along with the number
        and quality of results to return.
    LabelSearchResponse:
      properties:
        results:
          items:
            $ref: '#/components/schemas/WorkbookResult'
          type: array
          title: Results
      type: object
      required:
        - results
      title: LabelSearchResponse
      description: The results of a spreadsheet data label search.
    WorkbookResult:
      properties:
        workbook_id:
          type: string
          title: Workbook Id
          description: UUID for the workbook
        creator_id:
          type: string
          title: Creator Id
          description: >-
            UUID for the user that uploaded the workbook. This will always be
            the UUID of the account linked to the API key used in the request.
        filename:
          type: string
          title: Filename
          description: Original filename of the workbook
        description:
          type: string
          title: Description
          description: Generated description summarising the contents of the workbook
        latest_version:
          type: integer
          title: Latest Version
          description: Most recent version number of the workbook
        thumbnail_url:
          type: string
          title: Thumbnail Url
          description: Absolute URL for a thumbnail of the workbook's first sheet
        labels:
          items:
            $ref: '#/components/schemas/LabelResult'
          type: array
          title: Labels
          description: Array of labels within the workbook that match the search query
        score:
          anyOf:
            - type: number
            - type: 'null'
          title: Score
          description: >-
            Relevance ranking of the workbook in relation to the search results
            (higher is better)
      type: object
      required:
        - workbook_id
        - creator_id
        - filename
        - description
        - latest_version
        - thumbnail_url
        - labels
      title: WorkbookResult
      description: |-
        Contains a workbook that includes data labels that match the search
        query.
    LabelResult:
      properties:
        for:
          type: string
          title: For
          description: Cell reference or range that contains the labelled data
        text:
          type: string
          title: Text
          description: Text content of the label
        value:
          type: string
          title: Value
          description: >-
            The labelled data value(s). If a range of data is labelled, this
            will be a stringified JSON array
        score:
          anyOf:
            - type: number
            - type: 'null'
          title: Score
          description: >-
            Relevance ranking of the workbook in relation to the search results
            (higher is better)
      type: object
      required:
        - for
        - text
        - value
      title: LabelResult
      description: |-
        A label search result. Includes the location, text content, value,
        and score.
  securitySchemes:
    apiKey:
      type: http
      scheme: bearer
      bearerFormat: JWT

````