evaluations

Test Hog evaluation code against sample events without saving.

post/api/projects/{project_id}/evaluations/test_hog/

Request

  • Base URL: https://us.posthog.com
  • URL: https://us.posthog.com/api/projects/{project_id}/evaluations/test_hog/
  • Auth: HTTP bearer

Path parameters

project_idstring required

Project ID of the project you're trying to access. To find the ID of the project, make a call to /api/projects/.

Request body

output_type'boolean' | 'numeric' | 'categorical'
  • boolean - Boolean (Pass/Fail)
  • numeric - Numeric
  • categorical - Categorical
sourcestring required

Hog source code to test. Return a boolean, finite number, or category keys matching output_type. Categorical single selection accepts one key or a one-item list; multiple selection accepts a list, including []. Return null only for allowed N/A. Output settings determine which boolean counts as a failure.

sample_countinteger

Number of recent $ai_generation events to test against (1–10, default 5).

allows_naboolean

Whether the evaluation can return N/A for non-applicable generations.

conditionsobject[]

Optional trigger conditions to filter which events are sampled.

target'generation' | 'trace' | 'session'
  • generation - Generation
  • trace - Trace
  • session - Session

Response

messagestring

Optional message, e.g. when no recent events were found.

Changes

No recorded changes to this operation across all 1 revision of this API.