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

# Vyhledávání produktů

> Vyhledávejte produkty na webu a strukturujte výsledky podle svého schématu.

## Poznámky k použití

* Odešlete buď `schema_id`, nebo `columns`, nikdy obojí. Když vynecháte obě pole, Lasso použije výchozí Product Schema.
* `max_results` přijímá hodnoty `1` až `7` a výchozí hodnota je `7`.
* Jedno vyhledávání stojí 5 kreditů bez ohledu na počet vrácených produktů.
* Bez `webhook_url` požadavek čeká na odpověď `200`. S `webhook_url` Lasso vrátí `202` a dokončený výsledek odešle na vaši URL.
* `model` je zastaralé kompatibilní pole. Služba jeho hodnotu ignoruje a používá nakonfigurovaný Gemini provider.
* Při nedostatku kreditů synchronní režim aktuálně vrátí HTTP `200` s `error: "Insufficient credits"`, prázdným polem `results` a `credits_used: 0`.

Filtry produktů zapisujte přímo do `query`, například `Sony sluchátka do 5 000 Kč s nabíjením USB-C`.

## Příklady

```bash cURL theme={null}
curl --request POST \
  --url https://app.productlasso.com/api/v1/search \
  --header "Authorization: Bearer $LASSO_API_KEY" \
  --header "Content-Type: application/json" \
  --data '{
    "query": "Sony wireless earbuds under $200 with USB-C charging",
    "columns": [
      {"key": "product_name", "label": "Product name", "type": "text"},
      {"key": "price", "label": "Price", "type": "number"}
    ],
    "max_results": 3
  }'
```

```typescript TypeScript theme={null}
const response = await fetch("https://app.productlasso.com/api/v1/search", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.LASSO_API_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    query: "Sony wireless earbuds under $200 with USB-C charging",
    columns: [
      { key: "product_name", label: "Product name", type: "text" },
      { key: "price", label: "Price", type: "number" },
    ],
    max_results: 3,
  }),
});

if (!response.ok) throw new Error(await response.text());
const result = await response.json();
```

```python Python theme={null}
import os
import requests

response = requests.post(
    "https://app.productlasso.com/api/v1/search",
    headers={"Authorization": f"Bearer {os.environ['LASSO_API_KEY']}"},
    json={
        "query": "Sony wireless earbuds under $200 with USB-C charging",
        "columns": [
            {"key": "product_name", "label": "Product name", "type": "text"},
            {"key": "price", "label": "Price", "type": "number"},
        ],
        "max_results": 3,
    },
    timeout=120,
)
response.raise_for_status()
result = response.json()
```

```json Example response theme={null}
{
  "id": "6caa3d91-4ba7-4c14-8b31-9a7d92693ac9",
  "status": "completed",
  "query": "Sony wireless earbuds under $200 with USB-C charging",
  "results": [
    {
      "data": {"product_name": "Sony WF-C700N", "price": 119.99},
      "source_url": "https://example.com/products/sony-wf-c700n",
      "source_title": "Sony WF-C700N product page",
      "confidence": 0.94
    }
  ],
  "total_results": 1,
  "credits_used": 5
}
```


## OpenAPI

````yaml openapi.yaml POST /search
openapi: 3.1.0
info:
  title: Lasso API
  description: AI-powered product data extraction and enhancement API
  version: 1.0.0
  contact:
    name: Lasso Support
    url: https://lasso.ai
  license:
    name: MIT
    url: https://opensource.org/licenses/MIT
servers:
  - url: https://app.productlasso.com/api/v1
    description: Production
security:
  - BearerAuth: []
paths:
  /search:
    post:
      tags:
        - Search
      summary: Search for products
      description: >
        Search the web for products matching a natural language query and use AI
        to return

        structured data from the search results. Filters should be embedded in
        the query (e.g. "Sony earbuds under $200").

        Optionally provide a schema_id or inline columns to control the output
        shape.

        If neither is provided, a default product schema is used.
      operationId: searchProducts
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - query
              properties:
                query:
                  type: string
                  description: Natural language search objective
                schema_id:
                  type: string
                  description: ID of an existing schema. Mutually exclusive with columns.
                columns:
                  type: array
                  items:
                    $ref: '#/components/schemas/InlineColumn'
                  description: >-
                    Inline column definitions. Mutually exclusive with
                    schema_id.
                max_results:
                  type: integer
                  default: 7
                  minimum: 1
                  maximum: 7
                model:
                  type: string
                  deprecated: true
                  description: >-
                    Legacy compatibility field. The service ignores the
                    requested value and uses its configured Gemini provider.
                webhook_url:
                  type: string
                  format: uri
                  description: >-
                    If provided, results are delivered via webhook and 202 is
                    returned immediately.
            example:
              query: Sony wireless earbuds under $200 with USB-C charging
              columns:
                - key: product_name
                  label: Product name
                  type: text
                - key: price
                  label: Price
                  type: number
              max_results: 3
      responses:
        '200':
          description: >-
            Search results in synchronous mode. Worker failures such as
            insufficient credits can currently appear as an `error` field in
            this HTTP `200` response.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SearchResponse'
              example:
                id: 6caa3d91-4ba7-4c14-8b31-9a7d92693ac9
                status: completed
                query: Sony wireless earbuds under $200 with USB-C charging
                results:
                  - data:
                      product_name: Sony WF-C700N
                      price: 119.99
                    source_url: https://example.com/products/sony-wf-c700n
                    source_title: Sony WF-C700N product page
                    confidence: 0.94
                total_results: 1
                credits_used: 5
        '202':
          description: Search queued (async / webhook mode)
          content:
            application/json:
              schema:
                type: object
                properties:
                  id:
                    type: string
                  status:
                    type: string
                    enum:
                      - processing
                  estimated_credits:
                    type: number
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
      x-codeSamples:
        - lang: bash
          label: cURL
          source: |
            curl --request POST \
              --url https://app.productlasso.com/api/v1/search \
              --header "Authorization: Bearer $LASSO_API_KEY" \
              --header "Content-Type: application/json" \
              --data '{
                "query": "Sony wireless earbuds under $200 with USB-C charging",
                "columns": [
                  {"key": "product_name", "label": "Product name", "type": "text"},
                  {"key": "price", "label": "Price", "type": "number"}
                ],
                "max_results": 3
              }'
        - lang: typescript
          label: TypeScript
          source: >
            const response = await
            fetch("https://app.productlasso.com/api/v1/search", {
              method: "POST",
              headers: {
                Authorization: `Bearer ${process.env.LASSO_API_KEY}`,
                "Content-Type": "application/json",
              },
              body: JSON.stringify({
                query: "Sony wireless earbuds under $200 with USB-C charging",
                columns: [
                  { key: "product_name", label: "Product name", type: "text" },
                  { key: "price", label: "Price", type: "number" },
                ],
                max_results: 3,
              }),
            });


            if (!response.ok) throw new Error(await response.text());

            const result = await response.json();
        - lang: python
          label: Python
          source: |
            import os
            import requests

            response = requests.post(
                "https://app.productlasso.com/api/v1/search",
                headers={"Authorization": f"Bearer {os.environ['LASSO_API_KEY']}"},
                json={
                    "query": "Sony wireless earbuds under $200 with USB-C charging",
                    "columns": [
                        {"key": "product_name", "label": "Product name", "type": "text"},
                        {"key": "price", "label": "Price", "type": "number"},
                    ],
                    "max_results": 3,
                },
                timeout=120,
            )
            response.raise_for_status()
            result = response.json()
components:
  schemas:
    InlineColumn:
      type: object
      required:
        - key
        - label
        - type
      description: >-
        Ephemeral output shape for search/enrich; it does not create or attach a
        shared Attribute.
      properties:
        key:
          type: string
        label:
          type: string
        type:
          $ref: '#/components/schemas/ColumnType'
        required:
          type: boolean
          default: false
        description:
          type: string
        enum_values:
          type: array
          items:
            type: string
    SearchResponse:
      type: object
      properties:
        id:
          type: string
        status:
          type: string
          enum:
            - completed
        query:
          type: string
        results:
          type: array
          items:
            $ref: '#/components/schemas/SearchResult'
        total_results:
          type: integer
        credits_used:
          type: number
        error:
          type: string
          description: >-
            Present when the worker could not complete the search, including
            insufficient-credit outcomes. The current synchronous handler can
            still return this payload with HTTP `200`.
    ColumnType:
      type: string
      enum:
        - text
        - number
        - url
        - email
        - date
        - boolean
        - richtext
        - runnable
        - format
        - enum
        - tags
        - image
        - images
        - file
        - files
        - json
        - relation
    SearchResult:
      type: object
      properties:
        data:
          type: object
          additionalProperties: true
        source_url:
          type: string
        source_title:
          type: string
        confidence:
          type: number
          minimum: 0
          maximum: 1
    Error:
      type: object
      required:
        - status_code
        - error_type
        - message
        - request_id
      properties:
        status_code:
          type: integer
        error_type:
          type: string
          enum:
            - invalid_request
            - unauthenticated
            - forbidden
            - not_found
            - conflict
            - validation_error
            - rate_limited
            - service_unavailable
            - internal_error
        message:
          type: string
        request_id:
          type: string
        code:
          type: string
          description: >-
            Stable machine-readable detail code for validation, conflict, and
            retryable availability errors.
        retryable:
          type: boolean
          description: Whether the request can be retried without changing its payload.
        attribute_id:
          type: string
          format: uuid
          description: Stable Attribute identity when the error is scoped to one Attribute.
        attribute_key:
          type: string
          description: Attribute key when the error is scoped to one Attribute.
        details:
          type: object
          additionalProperties: true
        current_updated_at:
          type: string
          format: date-time
          description: >-
            Current resource revision supplied for client-directed refetch after
            a stale write.
  responses:
    BadRequest:
      description: Invalid request
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    Unauthorized:
      description: Authentication error
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: API Key

````

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