Skip to main content
POST
Search source files

Authorizations

Authorization
string
header
required

Cactal API key. Create one in the dashboard or via POST /apiKeys. The plaintext key is shown once at creation.

Body

application/json
websiteId
string
required
Minimum string length: 1
pattern
string
required

Text to find. Literal unless isRegex is set. Matched line by line, so ^ and $ anchor to line boundaries and a pattern cannot span a newline.

Required string length: 1 - 500
target
enum<string>

Version alias to read: head (default) or published.

Available options:
head,
published
version
integer

Explicit source version. Takes precedence over target.

Required range: x <= 9007199254740991
isRegex
boolean

Read pattern as a regular expression. JavaScript syntax works, including \b, \d, lookahead, and lazy quantifiers; named capture groups are not supported.

caseSensitive
boolean

Match case exactly. Defaults to true.

nameGlob
string

Only search names matching this glob. * and ? stop at a /; ** crosses them, for example blog/**.

Required string length: 1 - 255
type
enum<string>

Only search files of this type.

Available options:
page,
component,
module,
global_css,
not_found,
website_config,
custom_head_start,
custom_head_end,
custom_body_start,
custom_body_end
filesOnly
boolean

Return one entry per matching file, with no line detail.

contextLines
integer

Surrounding lines to return on each side of a match (0 to 3). Defaults to 0.

Required range: 0 <= x <= 3
maxMatchesPerFile
integer

Maximum matches from any one file (up to 50). Defaults to 10.

Required range: 1 <= x <= 50
cursor
string

Opaque cursor from the previous page. Pass the returned version too to keep the search pinned.

limit
integer
default:20

Maximum matches to return per page. Defaults to 20, maximum 100.

Required range: 1 <= x <= 100

Response

A page of matches for the requested source version.

items
object[]
required
nextCursor
string | null
required

Opaque cursor for the next page. Pass it as the cursor parameter on the next request. null when this is the last page.

websiteId
string
required

Id of the website.

version
integer
required

Source version that was searched. Pass it as version when continuing.

truncated
boolean

true when a file on this page had more matches than maxMatchesPerFile. Raise it, or narrow the pattern, to see the rest.