Skip to main content
POST

Description

Records user behavior that powers personalization, attribution, analytics, and model training. event_id must be the non-zero integer shown for an event in your dashboard. Event names such as "click" are display labels and are not accepted as identifiers.

Request

Search events

A search is an event with a query and no item_id. It weighs into that user’s recommendations by the weight of its event type, like any other event. event_id is optional: it defaults to the event your search signal is bound to, and one named Search (weight 25) is created on first use when nothing is bound yet. The items in result_item_ids are stored as impressions, never as items the user chose.
To record a search and get recommendations back in one call, send it to POST /v1/search with result_item_ids instead. Camel-case aliases userId, itemId, eventId, contextId, sessionId, requestId, and resultItemIds remain available, but all identifier aliases carry the same integer values. Event batches are capped at 200 events per request by default.

Response

The response also returns ingestion stats (inserted, processed, session) and an embedding_refresh block describing the async user-embedding refresh job that was enqueued for the affected users.

Errors

Authorizations

Authorization
string
header
required

The access token received from the authorization server in the OAuth 2.0 flow.

FlowClient Credentials
Token URL
https://auth.neuronsearchlab.com/oauth2/token
Scopes1
neuronsearchlab-api/write
Create, update, and delete items; submit events.

Body

application/json

A user ID is always required. An item event needs a non-zero dashboard event_id and a positive NSL-generated item_id. A search event sends a query and no item_id; its event_id is optional and defaults to the event your search signal is bound to. context_id is a positive NSL-generated integer when supplied.

user_id
string

End-user identifier.

Example:

"user-abc123"

userId
string

CamelCase alias for user_id.

item_id
integer

Item ID returned by NSL ingestion. Required unless the event is a search (a query with no item).

Required range: x >= 1
Example:

3187

itemId
integer

CamelCase alias for item_id.

Required range: x >= 1
query
string

What the user searched for. An event with a query and no item_id is a search event: it steers the user's recommendations by the weight of its event type, and event_id defaults to the event your search signal is bound to. With an item_id, the query is kept on the item event as the search the user reached it from. Longer queries are cut to 256 characters.

Maximum string length: 256
Example:

"waterproof trail shoes"

result_item_ids
integer[]

Item IDs your own search engine showed for query, in rank order. Recorded as impressions, not as items the user chose. Only accepted on a search event; the first 50 are kept.

Maximum array length: 50
Required range: x >= 1
Example:
resultItemIds
integer[]

CamelCase alias for result_item_ids.

Required range: x >= 1
event_id
integer

Non-zero event ID shown in dashboard Event configuration. Optional on a search event, where it defaults to your Search event.

eventId
integer

CamelCase alias for event_id.

session_id
string

Optional session identifier.

sessionId
string

CamelCase alias for session_id.

request_id
string<uuid>

Recommendation request ID to attribute this event to.

requestId
string<uuid>

CamelCase alias for request_id.

context_id
integer

Optional context ID created in the dashboard.

Required range: x >= 1
Example:

101

contextId
integer

CamelCase alias for context_id.

Required range: x >= 1
Example:

101

placement
string

Surface or placement where the event happened.

Example:

"home_feed"

metadata
object

Arbitrary JSON object used for filtering, ranking, and debugging.

Example:
occurred_at

Event occurrence timestamp. Numeric values below 1e12 are interpreted as Unix seconds.

Example:

1777478400

occurredAt

CamelCase alias for occurred_at.

timestamp

Legacy timestamp alias.

client_ts

Legacy client timestamp alias.

clientTs

CamelCase alias for client_ts.

Response

Inserted events

object
enum<string>
required
Available options:
list
data
object[]
required
has_more
boolean
required
url
string
required
inserted
integer
required
Required range: x >= 0
processed
integer
required
Required range: x >= 0
session
object
required
embedding_refresh
object
required
next_cursor
string | null