Skip to content

Files

Search file content

Search indexed text in active workspace files and return matching lines with file IDs and line numbers. `folderPaths` limits both results and reported coverage. Missing matches are inconclusive if `complete` is false or `indexStatus.skippedFiles` or `indexStatus.partialFiles` is nonzero. `truncated` means additional matches exist beyond `maxResults`. OAuth scope: `api:read`.

GET/api/v2/files/search

Search indexed text in active workspace files and return matching lines with file IDs and line numbers. folderPaths limits both results and reported coverage. Missing matches are inconclusive if complete is false or indexStatus.skippedFiles or indexStatus.partialFiles is nonzero. truncated means additional matches exist beyond maxResults.

OAuth scope: api:read.

Authentication

Send a personal or workspace API key in X-API-Key. See key types and access; operations that reject workspace keys say so in their description.

Send X-API-Key in the request header.

Alternatively

Send a Sim OAuth access token in Authorization: Bearer. See OAuth authentication and scopes.

Authorization: Bearer YOUR_ACCESS_TOKEN

Required scopes: api:read

OAuth flows
json
{
  "authorizationCode": {
    "authorizationUrl": "https://www.sim.ai/api/auth/oauth2/authorize",
    "tokenUrl": "https://www.sim.ai/api/auth/oauth2/token",
    "refreshUrl": "https://www.sim.ai/api/auth/oauth2/token",
    "scopes": {
      "api:read": "Read your workspaces, workflows, files, tables, and logs",
      "api:write": "Read, create, change, run, and delete resources in your workspaces",
      "offline_access": "Stay signed in without asking again"
    }
  }
}

OAuth scope: api:read.

Query parameters

workspaceIdstringRequired

Workspace to search.

minLength
1
maxLength
128
querystringRequired

Regular expression, or exact text when mode is exact.

minLength
3
maxLength
512
modestring

How query is read.

default
regex
enum
["exact","regex"]
maxResultsinteger

Maximum matching lines to return.

default
50
minimum
1
maximum
200
folderPathsstring

Folders the search is confined to, comma-separated. Absent searches the whole workspace. The scope also narrows indexStatus, so complete describes the folders searched rather than the workspace.

includeSubfoldersstring

Whether the scope descends into nested folders. Absent means yes. The listed spellings are the whole accepted vocabulary and are case-sensitive; any other value is rejected.

enum
["true","1","yes","on","y","enabled","false","0","no","off","n","disabled"]

Responses

200

Matching lines and the index coverage they were drawn from.

object

Matching lines from indexed workspace file content.

1 field
dataobjectRequired

Response data.

5 fields
resultsarrayRequired

Matching lines, one entry per line.

Schema details
Array itemobject
3 fields
fileIdstringRequired

File the line belongs to.

minLength
1
maxLength
128
pattern
^[A-Za-z0-9_-]+$
lineNumberintegerRequired

1-based line the match sits on.

minimum
1
maximum
9007199254740991
textstringRequired

The matching line.

Additional properties are not allowed.

countintegerRequired

Number of results returned.

minimum
0
maximum
9007199254740991
truncatedbooleanRequired

True when more matches exist beyond maxResults.

completebooleanRequired

True when no files in the searched scope have pending or failed indexing. Missing matches remain inconclusive unless this is true and both indexStatus.skippedFiles and indexStatus.partialFiles are zero.

indexStatusobjectRequired

Index coverage across the searched scope.

5 fields
readyFilesintegerRequired

Files whose current revision is indexed and searchable.

minimum
0
maximum
9007199254740991
pendingFilesintegerRequired

Files not yet indexed at their current revision. Their content was not searched.

minimum
0
maximum
9007199254740991
failedFilesintegerRequired

Files whose indexing failed. Their content was not searched.

minimum
0
maximum
9007199254740991
skippedFilesintegerRequired

Files deliberately not indexed, such as binaries and files above the size ceiling.

minimum
0
maximum
9007199254740991
partialFilesintegerRequired

Files indexed only in part, so matches beyond the indexed portion are not found.

minimum
0
maximum
9007199254740991

Additional properties are not allowed.

Additional properties are not allowed.

Additional properties are not allowed.

Response example 1

json
{
  "data": {
    "results": [
      {
        "fileId": "wf_V1StGXR8z5jdHi6BmyT91",
        "lineNumber": 4,
        "text": "- based in NYC"
      }
    ],
    "count": 1,
    "truncated": false,
    "complete": true,
    "indexStatus": {
      "readyFiles": 12,
      "pendingFiles": 0,
      "failedFiles": 0,
      "skippedFiles": 0,
      "partialFiles": 0
    }
  }
}

Response headers

X-RateLimit-Limitinteger

Maximum requests allowed in the current window.

minimum
0
maximum
9007199254740991
X-RateLimit-Remaininginteger

Requests remaining in the current window.

minimum
0
maximum
9007199254740991
X-RateLimit-Resetstring

ISO 8601 timestamp when the current rate-limit window resets.

format
date-time
pattern
^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d(?::[0-5]\d(?:\.\d+)?)?(?:Z))$
Was this helpful?
Suggest an edit