Search

The Search API lets you find files and folders in an Egnyte domain based on filenames, metadata, and text content. Search results are scoped to the authenticated user's permissions — users only see content they have access to.

The API supports two versions:

  • v1: Basic search using query parameters
  • v2: Advanced search with custom metadata filtering and similarity search using JSON request bodies

Note: All searches are performed in the context of the authenticated user. Results are automatically filtered based on the user's permissions.

Base URL

https://{domain}.egnyte.com/pubapi/v1/search
https://{domain}.egnyte.com/pubapi/v2/search

Authentication

All requests require an OAuth 2.0 Bearer token in the Authorization header:

Authorization: Bearer {access_token}

See Authentication for details on obtaining a token.


Search (v1)

Perform a basic search using query parameters. Supports filtering by filename, content, folder location, and modification dates.

Request

GET /pubapi/v1/search

Query Parameters

ParameterTypeRequiredDefaultDescription
querystringYes—The search string. Must be 3–100 characters.
offsetintegerNo0The 0-based index of the first result to return.
countintegerNo20Number of results per page. Must be 1–20.
folderstringNo—Limit results to items in this folder and its descendants. One folder per request. Must be URL-encoded once (e.g., /Shared/Documents%202/images).
modified_beforestringNo—Limit results to items modified before this ISO-8601 timestamp (e.g., 2020-08-01T18:43:23Z).
modified_afterstringNo—Limit results to items modified after this ISO-8601 timestamp.
uploaded_beforestringNo—Limit results to items uploaded before this ISO-8601 timestamp.
uploaded_afterstringNo—Limit results to items uploaded after this ISO-8601 timestamp.
typestringNo—Filter by item type. One of FILE, FOLDER.
snippet_requestedbooleanNotrueWhether to include text snippets in results. Set to false to return empty snippets.
sort_bystringNoscoreField to sort by. One of score, last_modified, size, name.
sort_directionstringNo—Sort direction. One of ascending, descending.
file_query_fieldsarrayNoALLSearch files in specific fields. One of ALL, FILENAME, COMMENTS, CONTENT.
folder_query_fieldsarrayNoALLSearch folders in specific fields. One of ALL, FOLDERNAME, DESCRIPTION.
query_operatorstringNoANYMatch all words or any word. One of ANY, ALL.

Example Request

curl -i -X GET "https://{domain}.egnyte.com/pubapi/v1/search?query=localcloudpress" \
     -H "Authorization: Bearer YOUR_ACCESS_TOKEN"

Response

200 OK

FieldTypeDescription
countintegerNumber of results returned in this response.
total_countintegerTotal number of matching results. If more than count results exist, returns count + 1.
offsetintegerThe 0-based index of the first result in this response.
resultsarrayArray of matching files and folders.
results[].namestringName of the file or folder.
results[].pathstringFull path to the item in Egnyte.
results[].typestringMIME type of the file (e.g., application/msword).
results[].sizeintegerSize of the file in bytes.
results[].snippetstringPlain text snippet containing matched content.
results[].snippet_htmlstringHTML-formatted snippet containing matched content.
results[].entry_idstringUnique GUID for this file or folder instance.
results[].group_idstringGroup identifier for the item.
results[].last_modifiedstringISO-8601 timestamp of last modification.
results[].uploaded_bystringDisplay name of the user who uploaded the file.
results[].uploaded_by_usernamestringUsername of the user who uploaded the file.
results[].num_versionsintegerNumber of versions available for this file.
results[].is_folderbooleantrue if the item is a folder, false if it's a file.

Example Response

{
  "results": [{
    "name": "LocalCloudPress.doc",
    "path": "/Shared/Documents/Sales/Proposals/LocalCloudPress.doc",
    "type": "application/msword",
    "size": 28672,
    "snippet": "Version5Version 45\nVersion 3\n\ngnyte brings its storage cloud closer to home\n\nFebruary 17, 2019\n\nhtt",
    "entry_id": "2c8e1083-47f8-4d57-94dc-fd05429b7ec3",
    "group_id": "61ed8373-6ff8-493f-8c6f-g4d8a05867243",
    "last_modified": "2020-01-14T22:19:29Z",
    "uploaded_by": "David Pfeffer",
    "uploaded_by_username": "david",
    "num_versions": 1,
    "snippet_html": "Version5Version 45\nVersion 3\n\ngnyte brings its storage cloud closer to home\n\nFebruary 17, 2019\n\nhtt",
    "is_folder": false
  }],
  "total_count": 20,
  "offset": 0,
  "count": 1
}

Search (v2)

Perform advanced searches with custom metadata filtering and similarity search. Use this endpoint to search by metadata fields, find similar documents, or combine text and metadata queries.

Request

POST /pubapi/v2/search

Request Body

FieldTypeRequiredDescription
querystringNo*The search string. Must be 3–100 characters. *Either query or custom_metadata is required.
offsetintegerNoThe 0-based index of the first result to return. Default: 0.
countintegerNoNumber of results per page. Must be 1–20. Default: 20.
folderstringNoLimit results to items in this folder and its descendants. One folder per request. Do NOT URL-encode when using v2 (e.g., /Shared/Documents 2/images).
modified_beforeintegerNoLimit results to items modified before this Unix timestamp in milliseconds.
modified_afterintegerNoLimit results to items modified after this Unix timestamp in milliseconds.
uploaded_beforeintegerNoLimit results to items uploaded before this Unix timestamp in milliseconds.
uploaded_afterintegerNoLimit results to items uploaded after this Unix timestamp in milliseconds.
typestringNoFilter by item type. One of FILE, FOLDER, ALL. Default: ALL.
snippet_requestedbooleanNoWhether to include text snippets in results. Default: true.
sort_bystringNoField to sort by. One of score, last_modified, size, name. Default: score.
sort_directionstringNoSort direction. One of ascending, descending.
query_operatorstringNoMatch all words or any word. One of ANY, ALL.
file_query_fieldsarrayNoSearch files in specific fields. One or more of ALL, FILENAME, COMMENTS, CONTENT.
folder_query_fieldsarrayNoSearch folders in specific fields. One or more of ALL, FOLDERNAME, DESCRIPTION.
custom_metadataarrayNo*Array of metadata filter objects. *Either query or custom_metadata is required.
namespacesarrayNoArray of namespace names to include in results. Only namespaces with values are returned.
mltarrayNoArray of document entry IDs to use as reference for similarity search.
mlttarrayNoArray of text strings to use as reference for similarity search.

v1 and v2 differ in two parameters. Sending the v1 form to v2, or the reverse, does not always return an error:

Parameterv1 (GET /pubapi/v1/search)v2 (POST /pubapi/v2/search)
Date filters (modified_*, uploaded_*)ISO-8601 string, e.g. 2026-01-01T00:00:00ZInteger, Unix epoch milliseconds, e.g. 1767225600000. An ISO-8601 string returns 400.
folderURL-encoded once, as a query parameterPlain path in the JSON body. A URL-encoded path may return no results.

Timestamps in responses, such as last_modified, are ISO-8601 in both versions.

Custom Metadata Filter Object

FieldTypeRequiredDescription
namespacestringYesName of the metadata namespace.
keystringYesMetadata key to search.
operatorstringYesSearch operator. One of EQUALS, GREATER_THAN, LESS_THAN, BETWEEN, IN, CONTAINS, HAS_KEY, HAS_NOT_KEY, SUB_SET.
valuestring/numberNo*Value for EQUALS, GREATER_THAN, LESS_THAN, CONTAINS operators. For dates, use Unix timestamp in milliseconds.
valuesarrayNo*Array of values for IN or SUB_SET operators.
rangeobjectNo*Range object for BETWEEN operator. Contains start (inclusive) and end (exclusive) fields.

*One of value, values, or range is required depending on the operator.

Example Request: Basic Metadata Search

curl -i -X POST "https://{domain}.egnyte.com/pubapi/v2/search" \
     -H "Content-Type: application/json" \
     -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
     -d '{
  "offset": 0,
  "count": 20,
  "namespaces": [
    "namespace1",
    "namespace2"
  ],
  "custom_metadata": [
    {
      "namespace": "bear",
      "key": "the name",
      "operator": "EQUALS",
      "value": "hi"
    }
  ]
}'

Example Request: Advanced Operators

curl -i -X POST "https://{domain}.egnyte.com/pubapi/v2/search" \
     -H "Content-Type: application/json" \
     -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
     -d '{
  "custom_metadata": [
    {
      "namespace": "ns1",
      "key": "status",
      "operator": "EQUALS",
      "value": "active"
    },
    {
      "namespace": "ns1",
      "key": "priority",
      "operator": "GREATER_THAN",
      "value": 3
    },
    {
      "namespace": "ns1",
      "key": "effort",
      "operator": "LESS_THAN",
      "value": 40
    },
    {
      "namespace": "ns1",
      "key": "review_date",
      "operator": "BETWEEN",
      "range": {
        "start": 1704085200000,
        "end": 1735621200000
      }
    },
    {
      "namespace": "ns2",
      "key": "document_type",
      "operator": "IN",
      "values": [
        "invoice",
        "contract"
      ]
    },
    {
      "namespace": "ns2",
      "key": "metadata_map",
      "operator": "HAS_KEY"
    },
    {
      "namespace": "ns2",
      "key": "description",
      "operator": "CONTAINS",
      "value": "budget"
    },
    {
      "namespace": "egnyte document tags",
      "key": "document type",
      "operator": "SUB_SET",
      "values": [
        "Employee Handbook",
        "Balance Sheet",
        "Annual Reports"
      ]
    }
  ]
}'

Example Request: Similarity Search

curl -i -X POST "https://{domain}.egnyte.com/pubapi/v2/search" \
     -H "Content-Type: application/json" \
     -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
     -d '{
  "mlt": [
    "83d56dc9-2290-4645-b68d-98e3ec123891",
    "753e3124-ae6c-4aa6-b9a8-933c16835f9f"
  ],
  "mltt": [
    "Includes notices to bidders, substitution request forms, and various standard forms. Division 01 covers general requirements."
  ],
  "folder": "/Shared/Projects"
}'

Response

200 OK

FieldTypeDescription
countintegerNumber of results returned in this response.
total_countintegerTotal number of matching results. If more than count results exist, returns count + 1.
offsetintegerThe 0-based index of the first result in this response.
hasMorebooleantrue if there are more results available.
resultsarrayArray of matching files and folders.
results[].namestringName of the file or folder.
results[].pathstringFull path to the item in Egnyte.
results[].typestringMIME type of the file.
results[].sizeintegerSize of the file in bytes.
results[].snippetstringPlain text snippet containing matched content.
results[].snippet_htmlstringHTML-formatted snippet containing matched content.
results[].entry_idstringUnique GUID for this file or folder instance.
results[].group_idstringGroup identifier for the item.
results[].last_modifiedstringISO-8601 timestamp of last modification.
results[].uploaded_bystringDisplay name of the user who uploaded the file.
results[].uploaded_by_usernamestringUsername of the user who uploaded the file.
results[].num_versionsintegerNumber of versions available for this file.
results[].is_folderbooleantrue if the item is a folder, false if it's a file.
results[].custom_propertiesarrayArray of custom metadata values for this item.
results[].custom_properties[].namespacestringMetadata namespace.
results[].custom_properties[].keystringMetadata key.
results[].custom_properties[].valuestringMetadata value.
results[].custom_properties[].scopestringMetadata scope (e.g., public).
results[].custom_properties[].valueToStampOnFilestringValue to display on file stamps (if applicable).
results[].scorenumberRelevance score for this result.

Example Response

{
  "count": 1,
  "total_count": 1,
  "hasMore": false,
  "results": [{
    "num_versions": 0,
    "name": "temp_image.jpg",
    "custom_properties": [
      {
        "scope": "public",
        "namespace": "bear",
        "value": "hi",
        "key": "the name"
      },
      {
        "scope": "public",
        "namespace": "bear",
        "value": "another value",
        "key": "a key not searched for"
      },
      {
        "scope": "public",
        "namespace": "namespace1",
        "value": "value1",
        "key": "key1"
      },
      {
        "scope": "public",
        "namespace": "namespace1",
        "value": "",
        "key": "key2"
      }
    ],
    "uploaded_by_username": "gyang",
    "snippet": "",
    "last_modified": "2020-08-27T01:31:00Z",
    "entry_id": "1603e372-75f2-4b9f-af74-080dec5e4aef",
    "is_folder": false,
    "uploaded_by": "Grant Yanng",
    "path": "/Shared/images/temp_image.jpg",
    "group_id": "1234567c-ac62-222f-a5d5-e84aaa4050f0",
    "type": "image/jpeg",
    "snippet_html": "",
    "size": 80972
  }],
  "offset": 0
}

Error Codes

StatusErrorDescriptionResolution
400Bad RequestInvalid query parameter or malformed JSON bodyVerify query length (3–100 characters), check JSON syntax, and ensure operator matches value type
401UnauthorizedInvalid or expired OAuth tokenRefresh your OAuth token
403ForbiddenUser lacks permission to access search resultsEnsure the user has read access to the folders being searched
404Not FoundRequested resource does not existVerify the request path
429Rate LimitedToo many requestsImplement exponential backoff; check Retry-After header

Note: If a folder-scoped search returns no results, check that the folder path exists and is encoded the right way for the API version (encoded once in v1, plain in v2).


Code Examples

GET /pubapi/v1/search?query=financial%20report&count=10&sort_by=last_mo...

curl -i -X GET "https://{domain}.egnyte.com/pubapi/v1/search?query=financial%20report&count=10&sort_by=last_modified&sort_direction=descending" \
     -H "Authorization: Bearer YOUR_ACCESS_TOKEN"

POST /pubapi/v2/search

curl -i -X POST "https://{domain}.egnyte.com/pubapi/v2/search" \
     -H "Content-Type: application/json" \
     -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
     -d '{
  "query": "contract",
  "custom_metadata": [
    {
      "namespace": "legal",
      "key": "status",
      "operator": "EQUALS",
      "value": "approved"
    }
  ],
  "namespaces": [
    "legal",
    "finance"
  ]
}'

POST /pubapi/v2/search

curl -i -X POST "https://{domain}.egnyte.com/pubapi/v2/search" \
     -H "Content-Type: application/json" \
     -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
     -d '{
  "mlt": [
    "83d56dc9-2290-4645-b68d-98e3ec123891"
  ],
  "mltt": [
    "Project specifications and requirements document"
  ],
  "folder": "/Shared/Projects",
  "count": 5
}'