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

# Create items

> Create catalog items for recommendation.

## Description

Creates one or more catalog items. Use `POST /v1/items/{item_id}` to update an existing item.

## Request

```http theme={null}
POST /v1/items
```

```json theme={null}
{
  "id": "7f3a2c9e",
  "name": "Wireless Headphones",
  "description": "Noise-cancelling Bluetooth headphones.",
  "metadata": {
    "category": "electronics",
    "brand": "Acme",
    "price": 10999,
    "currency": "usd"
  }
}
```

`id` is optional. If omitted, NeuronSearchLab generates an opaque ID. The aliases `item_id` and `itemId` are also accepted, but only one ID field should be present.

| Field         | Type   | Required | Description                                     |
| ------------- | ------ | -------- | ----------------------------------------------- |
| `id`          | string | no       | Item ID such as `7f3a2c9e`.                     |
| `name`        | string | yes      | Human-readable item name.                       |
| `description` | string | no       | Text used for embeddings and debugging.         |
| `metadata`    | object | no       | JSON object with filterable catalog attributes. |

You can also send an array of item objects to create multiple items in one call.

## Response

```json theme={null}
{
  "id": "7f3a2c9e",
  "object": "item",
  "name": "Wireless Headphones",
  "description": "Noise-cancelling Bluetooth headphones.",
  "metadata": {
    "category": "electronics",
    "brand": "Acme",
    "price": 10999,
    "currency": "usd"
  },
  "active": true,
  "created": 1777478400,
  "updated_at": 1777478400
}
```

When the request body is an array, the response is a list envelope (`object: "list"`) whose `data` array contains every created item. A single-item request returns the item resource directly.

## Errors

| Status | Scenario                                                      |
| ------ | ------------------------------------------------------------- |
| `400`  | Missing body, invalid JSON, missing `name`, or malformed `id` |
| `401`  | Missing or invalid Bearer token                               |
| `403`  | Token does not include `neuronsearchlab-api/write`            |
| `409`  | An item with the requested ID already exists                  |


## OpenAPI

````yaml POST /v1/items
openapi: 3.0.3
info:
  title: NeuronSearchLab Core API
  version: 1.0.0
  description: >-
    Versioned data-plane API for OAuth token exchange, catalog item ingestion,
    user event ingestion, and recommendation serving.
  license:
    name: Proprietary
    url: https://neuronsearchlab.com
servers:
  - url: https://api.neuronsearchlab.com
    description: Core API Gateway custom domain
security:
  - oauth2: []
tags:
  - name: Authentication
    description: OAuth 2.0 client credentials token exchange.
  - name: Items
    description: Catalog item ingestion, lookup, update, deletion, and pagination.
  - name: Events
    description: User interaction event ingestion, lookup, and pagination.
  - name: Recommendations
    description: >-
      Personalized recommendation serving, request-scoped filtering, and
      auto-section generation.
  - name: Search
    description: Query-driven search serving through the Core API data plane.
  - name: CORS
    description: Browser preflight routes generated by API Gateway.
paths:
  /v1/items:
    post:
      tags:
        - Items
      summary: Create items
      description: >-
        Create one or more catalog items. When `id` is omitted, the API
        generates an opaque ID. Single-item requests return an item; array
        requests return a list envelope.
      operationId: createItems
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ItemCreatePayload'
            examples:
              single:
                $ref: '#/components/examples/ItemCreate'
              bulk:
                $ref: '#/components/examples/ItemCreateBulk'
      responses:
        '200':
          description: Created item or created item list
          content:
            application/json:
              schema:
                oneOf:
                  - $ref: '#/components/schemas/Item'
                  - $ref: '#/components/schemas/ItemList'
              examples:
                item:
                  $ref: '#/components/examples/Item'
                itemList:
                  $ref: '#/components/examples/ItemList'
        '400':
          $ref: '#/components/responses/Error400'
        '401':
          $ref: '#/components/responses/Error401'
        '403':
          $ref: '#/components/responses/Error403'
        '409':
          $ref: '#/components/responses/Error409'
        '500':
          $ref: '#/components/responses/Error500'
      security:
        - oauth2:
            - neuronsearchlab-api/write
components:
  schemas:
    ItemCreatePayload:
      oneOf:
        - $ref: '#/components/schemas/ItemCreate'
        - type: array
          items:
            $ref: '#/components/schemas/ItemCreate'
          minItems: 1
    Item:
      type: object
      required:
        - id
        - object
        - name
        - description
        - metadata
        - active
        - created
        - updated_at
      properties:
        id:
          type: string
          pattern: ^[A-Za-z0-9][A-Za-z0-9_-]{0,127}$
          example: 7f3a2c9e
        object:
          type: string
          enum:
            - item
        name:
          type: string
          example: Wireless Headphones
        description:
          type: string
          example: Noise-cancelling Bluetooth headphones.
        metadata:
          $ref: '#/components/schemas/Metadata'
        active:
          type: boolean
          example: true
        created:
          type: integer
          format: int64
          nullable: true
          description: Unix timestamp in seconds.
          example: 1777478400
        updated_at:
          type: integer
          format: int64
          nullable: true
          description: Unix timestamp in seconds.
          example: 1777478500
    ItemList:
      allOf:
        - $ref: '#/components/schemas/ListEnvelope'
        - type: object
          properties:
            data:
              type: array
              items:
                $ref: '#/components/schemas/Item'
    ItemCreate:
      type: object
      required:
        - name
      properties:
        id:
          type: string
          description: Optional public item ID. If omitted, the API generates one.
          pattern: ^[A-Za-z0-9][A-Za-z0-9_-]{0,127}$
          example: 7f3a2c9e
        item_id:
          type: string
          description: Snake-case alias for `id`.
          pattern: ^[A-Za-z0-9][A-Za-z0-9_-]{0,127}$
        itemId:
          type: string
          description: CamelCase alias for `id`.
          pattern: ^[A-Za-z0-9][A-Za-z0-9_-]{0,127}$
        name:
          type: string
          minLength: 1
          example: Wireless Headphones
        description:
          type: string
          example: Noise-cancelling Bluetooth headphones.
        metadata:
          $ref: '#/components/schemas/Metadata'
      additionalProperties: false
    Metadata:
      type: object
      description: Arbitrary JSON object used for filtering, ranking, and debugging.
      additionalProperties: true
      example:
        category: electronics
        brand: Acme
        price: 10999
        currency: usd
    ListEnvelope:
      type: object
      required:
        - object
        - data
        - has_more
        - url
      properties:
        object:
          type: string
          enum:
            - list
        data:
          type: array
          items: {}
        has_more:
          type: boolean
        next_cursor:
          type: string
          nullable: true
        url:
          type: string
    ErrorResponse:
      type: object
      required:
        - error
      properties:
        error:
          type: object
          required:
            - type
            - code
            - message
          properties:
            type:
              type: string
              enum:
                - invalid_request_error
                - authentication_error
                - permission_error
                - not_found_error
                - conflict_error
                - rate_limit_error
                - api_error
            code:
              type: string
            message:
              type: string
            details: {}
            request_id:
              type: string
              format: uuid
          additionalProperties: true
  examples:
    ItemCreate:
      summary: Create one item
      value:
        id: 7f3a2c9e
        name: Wireless Headphones
        description: Noise-cancelling Bluetooth headphones.
        metadata:
          category: electronics
          brand: Acme
          price: 10999
          currency: usd
    ItemCreateBulk:
      summary: Create multiple items
      value:
        - id: 7f3a2c9e
          name: Wireless Headphones
          metadata:
            category: electronics
        - name: Portable Speaker
          metadata:
            category: electronics
    Item:
      summary: Item
      value:
        id: 7f3a2c9e
        object: item
        name: Wireless Headphones
        description: Noise-cancelling Bluetooth headphones.
        metadata:
          category: electronics
          brand: Acme
        active: true
        created: 1777478400
        updated_at: 1777478500
    ItemList:
      summary: Item list
      value:
        object: list
        data:
          - id: 7f3a2c9e
            object: item
            name: Wireless Headphones
            description: Noise-cancelling Bluetooth headphones.
            metadata:
              category: electronics
            active: true
            created: 1777478400
            updated_at: 1777478500
        has_more: false
        next_cursor: null
        url: /v1/items
    ErrorValidation:
      summary: Validation error
      value:
        error:
          type: invalid_request_error
          code: validation_error
          message: Validation error
          details:
            fieldErrors:
              name:
                - Required
    ErrorUnauthorized:
      summary: Unauthorized
      value:
        error:
          type: authentication_error
          code: unauthorized_no_client_id_in_jwt
          message: 'Unauthorized: No client ID in JWT'
    ErrorConflict:
      summary: Item already exists
      value:
        error:
          type: conflict_error
          code: item_already_exists
          message: Item already exists
          details:
            item_ids:
              - 7f3a2c9e
  responses:
    Error400:
      description: Invalid request
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          examples:
            validation:
              $ref: '#/components/examples/ErrorValidation'
    Error401:
      description: Unauthenticated
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          examples:
            unauthorized:
              $ref: '#/components/examples/ErrorUnauthorized'
    Error403:
      description: Forbidden
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    Error409:
      description: Conflict
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          examples:
            conflict:
              $ref: '#/components/examples/ErrorConflict'
    Error500:
      description: Server error
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
  securitySchemes:
    oauth2:
      type: oauth2
      flows:
        clientCredentials:
          tokenUrl: https://auth.neuronsearchlab.com/oauth2/token
          scopes:
            neuronsearchlab-api/read: Read recommendations, items, and events.
            neuronsearchlab-api/write: Create, update, and delete items; submit events.

````