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

# Get search history

> Retrieve search history for the authenticated user, sorted by most recent first (up to 1000 entries).



## OpenAPI

````yaml /api-reference/cx/swagger.json get /magic/_history
openapi: 3.0.0
info:
  description: CX API.
  title: CX API
  contact:
    name: API Support
    url: https://stax.ai
    email: support@stax.ai
  version: '1.0'
servers:
  - url: https://api.cx.stax.ai
security: []
paths:
  /magic/_history:
    get:
      tags:
        - magic
      summary: Get search history
      description: >-
        Retrieve search history for the authenticated user, sorted by most
        recent first (up to 1000 entries).
      responses:
        '200':
          description: Search history
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/pkg_routes_magic.HistoryResponse'
        '500':
          description: Internal server error
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
      security:
        - ApiKeyAuth: []
components:
  schemas:
    pkg_routes_magic.HistoryResponse:
      type: object
      properties:
        history:
          type: array
          items:
            $ref: '#/components/schemas/types.SearchHistory'
    types.SearchHistory:
      type: object
      properties:
        _id:
          type: string
        context:
          type: string
        query:
          type: string
        results:
          description: Number of results by type
          type: object
          additionalProperties:
            type: integer
        team:
          type: string
        timestamp:
          type: string
        user:
          type: string
  securitySchemes:
    ApiKeyAuth:
      description: CX API key. Create one in CX under Settings → Advanced → API Keys.
      in: header
      name: x-api-key
      type: apiKey

````

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