---
title: "Save (or overwrite) an events-page search"
method: POST
path: "/api/event_searches/"
tags: ["Events"]
---

# Save (or overwrite) an events-page search

`POST /api/event_searches/`

## Request

- Base URL: `https://eyalsec.com`
- URL: `https://eyalsec.com/api/event_searches/`
- Auth: one of:
  - API key in header `X-API-Key`
  - API key in cookie `__Host-es2session`

Stores one named search. Re-saving the same name in the same view overwrites it, because that is how a search is edited. name is 1 to 80 characters and is trimmed; query is at most 4096 characters and is a URL query string with no leading '?'; view must be python, browser, go, c, cpp, rust, node, solidity, java, bash, ruby or php. The reply is the view's whole list after the save, so the new row's id is available without a second call. Cookie callers must pass CSRF.

This is a **write**: a read-only API key is refused with 403.

## Request body

- object
  - `name` string, required: Label shown in the saved-search picker. 1 to 80 characters.
  - `view` string, required: python, browser, go, c, cpp, rust, node, solidity, java, bash, ruby or php.
  - `query` string: The events-page query string, without the leading '?'. At most 4096 characters. Empty saves a search with no filters.

## Response `201`

Created.

- object

## Other responses

- `401`: The API key is missing, wrong, revoked or expired.
- `429`: A rate limit was hit, or the account is locked after wrong passwords. Retry-After gives the seconds to wait.
- `default`: An error. Check the status first; the body carries a short message, as JSON ({"error": "..."}) on most endpoints and as plain text on some. 400: malformed JSON, an invalid regex, an unreadable cursor or date, or an unknown value. 401: the API key is missing, wrong, revoked or expired. 403: a failed CSRF check, a read-only key trying to write, a product or feature not enabled on your account, a wrong password, or a write on an account limited to reading. 404: not found, including things that belong to another account. 409: conflict with the current state. 422: a field is missing or invalid. 429: a rate limit was hit, or the account is locked after wrong passwords. 500: something failed on our side.

---

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