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

# Search accounts

> Search accounts with structured filters, sort, cursor pagination, and field projection. Custom attribute names and value types are returned in `data.custom_field_definitions`; keys in that map match keys under each account's `custom_fields` object.



## OpenAPI

````yaml /api-reference/openapi.json post /v1/accounts/search
openapi: 3.1.0
info:
  title: Octolane Public API
  version: 1.0.0
  description: >-
    OpenAPI specification for Octolane public APIs. These endpoints let external
    systems read CRM data and create or update accounts, contacts,
    opportunities, notes, and activities through the public API gateway.
  contact:
    name: Octolane
    url: https://octolane.com
servers:
  - url: https://api.octolane.com
    description: Public API gateway
security:
  - ApiKeyAuth: []
tags:
  - name: CRM
    description: >-
      Public endpoints for creating, bulk creating, listing, searching, and
      updating CRM data.
paths:
  /v1/accounts/search:
    post:
      tags:
        - CRM
      summary: Search accounts
      description: >-
        Search accounts with structured filters, sort, cursor pagination, and
        field projection. Custom attribute names and value types are returned in
        `data.custom_field_definitions`; keys in that map match keys under each
        account's `custom_fields` object.
      operationId: searchAccountsV1Compatibility
      requestBody:
        required: true
        description: >-
          Search body with optional text query, structured filters, sort, cursor
          pagination, and field projection.
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SearchRequest'
      responses:
        '200':
          description: Accounts were returned.
          content:
            application/json:
              schema:
                allOf:
                  - $ref: '#/components/schemas/ApiResponse'
                  - type: object
                    properties:
                      data:
                        $ref: '#/components/schemas/AccountsListData'
        '400':
          description: The request failed validation.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '401':
          description: >-
            The API key is missing, invalid, or not allowed to access this
            route.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '429':
          description: The route rate limit was exceeded.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
components:
  schemas:
    SearchRequest:
      type: object
      properties:
        query:
          type: string
        q:
          type: string
        filters:
          type: array
          maxItems: 50
          items:
            $ref: '#/components/schemas/SearchFilter'
        sort:
          oneOf:
            - type: string
              pattern: ^[^:]+(?::(asc|desc))?$
              description: >-
                Compact sort expression. Use `field`, `field:asc`, or
                `field:desc`.
            - $ref: '#/components/schemas/SearchSort'
            - type: array
              maxItems: 1
              items:
                $ref: '#/components/schemas/SearchSort'
        cursor:
          type:
            - string
            - 'null'
        limit:
          type: integer
          minimum: 1
          maximum: 500
        fields:
          type: array
          maxItems: 100
          items:
            type: string
      additionalProperties: false
    ApiResponse:
      type: object
      properties:
        success:
          type: boolean
          example: true
        message:
          type: string
        data:
          description: Endpoint-specific response payload.
      additionalProperties: true
    AccountsListData:
      allOf:
        - $ref: '#/components/schemas/CursorPageFields'
        - type: object
          required:
            - accounts
            - custom_field_definitions
            - has_more
            - next_cursor
            - limit
          properties:
            accounts:
              type: array
              items:
                $ref: '#/components/schemas/AccountRecord'
    ErrorResponse:
      type: object
      properties:
        success:
          type: boolean
          example: false
        message:
          type: string
          example: Validation failed
        statusCode:
          type: integer
          example: 400
      additionalProperties: true
    SearchFilter:
      type: object
      required:
        - field
      properties:
        field:
          type: string
          description: Public field name, system field alias, or custom field slug.
        operator:
          type: string
          default: eq
          enum:
            - eq
            - neq
            - contains
            - not_contains
            - starts_with
            - ends_with
            - in
            - not_in
            - gt
            - gte
            - lt
            - lte
            - between
            - empty
            - not_empty
            - contains_all
            - contains_none
          description: >-
            Filter operator. For multi-value operators such as `in`, `not_in`,
            `between`, `contains_all`, and `contains_none`, pass an array in
            `value`.
        value:
          description: >-
            Filter value. For date/time fields such as `created_at`,
            `updated_at`, `close_date`, and custom date/timestamp fields, pass
            an ISO 8601 date or date-time string such as `2024-06-11T01:40:00Z`;
            Unix timestamps such as `1718070000` are not accepted in search
            filters. Use an array here for multi-value operators; omit for
            `empty` and `not_empty`.
          oneOf:
            - type: string
            - type: number
            - type: boolean
            - type: array
              items: {}
            - type: 'null'
      example:
        field: created_at
        operator: gt
        value: '2024-06-11T01:40:00Z'
      additionalProperties: false
    SearchSort:
      type: object
      required:
        - field
      properties:
        field:
          type: string
        direction:
          type: string
          enum:
            - asc
            - desc
          default: desc
      additionalProperties: false
    CursorPageFields:
      type: object
      properties:
        custom_field_definitions:
          $ref: '#/components/schemas/CustomFieldDefinitions'
        has_more:
          type: boolean
          description: Whether another page is available.
        next_cursor:
          type:
            - string
            - 'null'
          description: Cursor to pass on the next request when `has_more` is true.
        limit:
          type: integer
          description: Effective page size used for this response.
    AccountRecord:
      type: object
      description: Account record. Additional selected system fields may be present.
      properties:
        id:
          type: string
          format: uuid
        name:
          type:
            - string
            - 'null'
        domain:
          type:
            - string
            - 'null'
        custom_fields:
          $ref: '#/components/schemas/RecordCustomFields'
      additionalProperties: true
    CustomFieldDefinitions:
      type: object
      description: >-
        Map of custom field slug to definition. This is returned by
        `/v1/accounts`, `/v1/accounts/search`, `/v1/contacts`,
        `/v1/contacts/search`, `/v1/opportunities`, and
        `/v1/opportunities/search`. The map key matches the key used under each
        record's `custom_fields` object. If the request uses `fields`, only
        selected custom fields are included; otherwise all visible custom fields
        for the object are included. For opportunities, definitions are scoped
        to the requested `pipeline_id`.
      additionalProperties:
        $ref: '#/components/schemas/CustomFieldDefinition'
      example:
        last_action_date:
          current_name: Last Action Date
          property_name: custom__last_action_date
          attribute_type: date
          metadata: null
        kola:
          current_name: Kola
          property_name: custom__kola
          attribute_type: multi_select
          metadata:
            options:
              - label: E
                value: e-532837
                color: indigo
    RecordCustomFields:
      type: object
      description: >-
        Custom field values keyed by custom field slug. Use the sibling
        `custom_field_definitions` map in the same response to get each custom
        field's display name (`current_name`), stable property name
        (`property_name`), and value type (`attribute_type`).
      additionalProperties: true
    CustomFieldDefinition:
      type: object
      description: >-
        Definition for one custom field returned under a record's
        `custom_fields` object.
      required:
        - current_name
        - property_name
        - attribute_type
      properties:
        current_name:
          type: string
          description: Display name configured for the custom field.
          example: Last action date
        property_name:
          type: string
          description: >-
            Stable internal property name for the custom field. This can be used
            in field selection, filtering, and update payloads where custom
            properties are accepted.
          example: custom__last_action_date
        attribute_type:
          type: string
          description: >-
            Value type for this custom field. Use this to format request values
            and interpret `custom_fields` values.
          enum:
            - string
            - number
            - checkbox
            - date
            - date_range
            - rating
            - timestamp
            - select
            - multi_select
            - currency
            - percentage
            - location
            - time
            - datetime
            - email
            - phone
            - website
            - url
            - radio
            - team_members
          example: date
        metadata:
          oneOf:
            - type: object
              additionalProperties: true
            - type: 'null'
          description: >-
            Optional field metadata such as select options. Shape depends on
            `attribute_type`.
      additionalProperties: false
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: x-api-key
      description: Public API key for the Octolane organization.

````