---
title: "Run an app's code now"
method: POST
path: "/api/v1/apps/{slug}/code/test"
---

# Run an app's code now

`POST /api/v1/apps/{slug}/code/test`

## Request

- Base URL: `https://anyhook.net`
- URL: `https://anyhook.net/api/v1/apps/{slug}/code/test`
- Auth: HTTP bearer

Runs the saved handler on a stored event (the latest when event_id is omitted) or on a body you pass, and answers with its logs and return value. Counts as a run. Nothing is delivered; whatever the code itself sends does happen.

## Path parameters

- `slug` string, required

## Request body

- object
  - `event_id` string, uuid
  - `body` unknown

## Response `200`

The run's outcome (ok is false when the handler threw)

- object
  - `ok` boolean
  - `value` unknown
  - `exports` unknown
  - `exited` string: Set when the handler ended early with $.flow.exit.
  - `error` string
  - `logs` string: Console output, last 16,000 characters.
  - `ms` integer
  - `event_id` string, uuid, nullable

## Other responses

- `403`: Read-only key, a plan without code handlers, or a handler AnyHook disabled
- `404`: No handler, or no event to run on
- `429`: Monthly runs used up

## Changes

- **2026-10-19** `ddf038fb32fc`: 1 info
  - added the non-success response with the status `403`

[Operation history](https://skmtc.dev/anyhook/apis/anyhook-api/changes/api/v1/apps/:slug/code/test/post.md)

---

[API](https://skmtc.dev/anyhook/apis/anyhook-api.md) · [All operations](https://skmtc.dev/anyhook/apis/anyhook-api/llms.txt) · [OpenAPI document](https://skmtc.dev/anyhook/apis/anyhook-api/revisions/ddf038fb32fc?raw)
