Skip to main content
POST
/
v1
/
agents
/
{agent_id}
/
workspace
/
glob
Workspace: Glob
curl --request POST \
  --url https://api.xpander.ai/v1/agents/{agent_id}/workspace/glob \
  --header 'Content-Type: application/json' \
  --header 'x-api-key: <api-key>' \
  --data '
{
  "pattern": "<string>",
  "root_dir": "",
  "max_results": 1000
}
'
import requests

url = "https://api.xpander.ai/v1/agents/{agent_id}/workspace/glob"

payload = {
"pattern": "<string>",
"root_dir": "",
"max_results": 1000
}
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
const options = {
method: 'POST',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({pattern: '<string>', root_dir: '', max_results: 1000})
};

fetch('https://api.xpander.ai/v1/agents/{agent_id}/workspace/glob', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));
<?php

$curl = curl_init();

curl_setopt_array($curl, [
CURLOPT_URL => "https://api.xpander.ai/v1/agents/{agent_id}/workspace/glob",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'pattern' => '<string>',
'root_dir' => '',
'max_results' => 1000
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <api-key>"
],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
package main

import (
"fmt"
"strings"
"net/http"
"io"
)

func main() {

url := "https://api.xpander.ai/v1/agents/{agent_id}/workspace/glob"

payload := strings.NewReader("{\n \"pattern\": \"<string>\",\n \"root_dir\": \"\",\n \"max_results\": 1000\n}")

req, _ := http.NewRequest("POST", url, payload)

req.Header.Add("x-api-key", "<api-key>")
req.Header.Add("Content-Type", "application/json")

res, _ := http.DefaultClient.Do(req)

defer res.Body.Close()
body, _ := io.ReadAll(res.Body)

fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.post("https://api.xpander.ai/v1/agents/{agent_id}/workspace/glob")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"pattern\": \"<string>\",\n \"root_dir\": \"\",\n \"max_results\": 1000\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.xpander.ai/v1/agents/{agent_id}/workspace/glob")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"pattern\": \"<string>\",\n \"root_dir\": \"\",\n \"max_results\": 1000\n}"

response = http.request(request)
puts response.read_body
{
  "matches": [
    "<string>"
  ],
  "total_found": 0,
  "truncated": false
}
{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}
Find files in the per-agent workspace matching a glob pattern (e.g. **/*.py). Useful for discovering files before reading or editing them.

Path Parameters

agent_id
string
required
Agent ID (UUID)

Request Body

pattern
string
required
Glob pattern to match (e.g. **/*.py).
root_dir
string
Directory to search from, relative to the workspace root. Defaults to the workspace root when omitted.
max_results
integer
default:1000
Maximum number of matches to return.

Response

status
string
Result status (e.g., ok).
matches
array
Array of matching file paths.

Example Request

curl -X POST "https://api.xpander.ai/v1/agents/<agent-id>/workspace/glob" \
  -H "Content-Type: application/json" \
  -H "x-api-key: <your-api-key>" \
  -d '{
    "pattern": "**/*.py",
    "root_dir": "src",
    "max_results": 1000
  }'

Notes

  • Use ** to match across directory boundaries and * to match anything within a single path segment.
  • Combine with Workspace: Grep to search the contents of the matched files.

See Also

Authorizations

x-api-key
string
header
required

API Key for authentication

Path Parameters

agent_id
string
required

Body

application/json
pattern
string
required

Glob pattern for file matching. Supports ** for recursive matching, * for wildcards.

Example:

"**/*.py"

root_dir
string
default:""

Root directory to search from, relative to workspace root.

Example:

"src"

max_results
integer
default:1000

Maximum number of results to return. Prevents excessive output for broad patterns.

Required range: 1 <= x <= 50000

Response

Successful Response

matches
string[]

List of matched file paths

total_found
integer
default:0

Total number of files matching the pattern

truncated
boolean
default:false

True if results were truncated due to max_results limit