## Grep File **post** `/api/v1/retrieval/files/grep` Grep within a file's parsed content using a regex pattern. ### Query Parameters - `organization_id: optional string` - `project_id: optional string` ### Cookie Parameters - `session: optional string` ### Body Parameters - `file_id: string` ID of the file to grep. - `index_id: string` ID of the index the file belongs to. - `pattern: string` Regex pattern to search for. - `context_chars: optional number` Number of characters of context to include before and after the matched pattern in the content field of the response - `page_size: optional number` The maximum number of items to return. The service may return fewer than this value. If unspecified, a default page size will be used. The maximum value is typically 1000; values above this will be coerced to the maximum. - `page_token: optional string` A page token, received from a previous list call. Provide this to retrieve the subsequent page. ### Returns - `items: array of object { content, end_char, start_char }` The list of items. - `content: string` Matched text content. - `end_char: number` End character offset of the match. - `start_char: number` Start character offset of the match. - `next_page_token: optional string` A token, which can be sent as page_token to retrieve the next page. If this field is omitted, there are no subsequent pages. - `total_size: optional number` The total number of items available. This is only populated when specifically requested. The value may be an estimate and can be used for display purposes only. ### Example ```http curl https://api.cloud.llamaindex.ai/api/v1/retrieval/files/grep \ -H 'Content-Type: application/json' \ -H "Authorization: Bearer $LLAMA_CLOUD_API_KEY" \ -d '{ "file_id": "file_id", "index_id": "idx-abc123", "pattern": "revenue|profit" }' ``` #### Response ```json { "items": [ { "content": "content", "end_char": 0, "start_char": 0 } ], "next_page_token": "next_page_token", "total_size": 0 } ```