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

# Search Entities

> Semantic search over entities by cosine similarity to the query embedding.

App-scoped, not user-scoped: searches the whole app's entity graph (see
the module-docstring tenancy contract).

POST (not GET) because vectors don't fit nicely in querystrings — and we
may want to extend the request body with filters later.



## OpenAPI

````yaml https://app.stainlessapi.com/api/spec/documented/hyperspell.yaml post /entities/search
openapi: 3.1.0
info:
  title: Hyperspell API
  summary: >-
    Hyperspell is the memory layer for AI apps and agents. Through the API, you
    can add memories, connect data sources to index them in real-time, and
    search memories with our natural language query engine.
  termsOfService: https://hyperspell.com/blog/tos
  contact:
    name: Hyperspell
    url: https://hyperspell.com/
    email: hello@hyperspell.com
  version: 0.32.1
servers:
  - url: https://api.hyperspell.com
    description: Production
security:
  - APIKey: []
    AsUser: []
paths:
  /entities/search:
    post:
      tags:
        - entities
      summary: Search Entities
      description: >-
        Semantic search over entities by cosine similarity to the query
        embedding.


        App-scoped, not user-scoped: searches the whole app's entity graph (see

        the module-docstring tenancy contract).


        POST (not GET) because vectors don't fit nicely in querystrings — and we

        may want to extend the request body with filters later.
      operationId: search_entities_entities_search_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/EntitySearchRequest'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/EntitySearchResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - APIKey: []
        - AsUser: []
components:
  schemas:
    EntitySearchRequest:
      properties:
        query:
          type: string
          title: Query
        type:
          anyOf:
            - type: string
            - type: 'null'
          title: Type
        limit:
          type: integer
          maximum: 100
          minimum: 1
          title: Limit
          default: 20
      type: object
      required:
        - query
      title: EntitySearchRequest
    EntitySearchResponse:
      properties:
        items:
          items:
            $ref: '#/components/schemas/EntityWithScoreResponse'
          type: array
          title: Items
      type: object
      required:
        - items
      title: EntitySearchResponse
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    EntityWithScoreResponse:
      properties:
        id:
          type: string
          format: uuid
          title: Id
        type:
          type: string
          title: Type
        name:
          type: string
          title: Name
        description:
          anyOf:
            - type: string
            - type: 'null'
          title: Description
        attributes:
          additionalProperties: true
          type: object
          title: Attributes
        mention_count:
          type: integer
          title: Mention Count
        first_seen_resource_id:
          anyOf:
            - type: string
            - type: 'null'
          title: First Seen Resource Id
        last_seen_resource_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Last Seen Resource Id
        created_at:
          type: string
          format: date-time
          title: Created At
        updated_at:
          type: string
          format: date-time
          title: Updated At
        similarity:
          type: number
          title: Similarity
      type: object
      required:
        - id
        - type
        - name
        - mention_count
        - created_at
        - updated_at
        - similarity
      title: EntityWithScoreResponse
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
  securitySchemes:
    APIKey:
      type: http
      description: >-
        API Key or JWT User Token. If using an API Key, set the X-As-User header
        to act as a specific user. A JWT User Token is always scoped to a
        specific user.
      scheme: bearer
      bearerFormat: Bearer <token>
    AsUser:
      type: apiKey
      description: >-
        Optionally set this header to act as a specific user when using an API
        Key, equivalent to first exchanging the API Key for a User Token
      in: header
      name: X-As-User

````