Skip to main content

Sources

Sources are the foundation of Ground. They represent the repositories and documentation you want to index and search.

Source Types

Repository Sources (repo)

Index code from Git repositories with language-aware chunking.
{
  "name": "My SDK",
  "source_type": "repo",
  "url": "https://github.com/org/repo",
  "branch": "main",
  "include_patterns": ["*.py", "*.ts"],
  "exclude_patterns": ["tests/**", "node_modules/**"]
}
Fields:
  • branch: Git branch to index (default: main)
  • include_patterns: Glob patterns for files to include
  • exclude_patterns: Glob patterns for files to exclude

Documentation Sources (docs)

Index documentation from websites or API specifications.

HTML Documentation

{
  "name": "FastAPI Docs",
  "source_type": "docs",
  "docs_format": "html",
  "url": "https://fastapi.tiangolo.com",
  "use_sitemap": true
}
Or with explicit URL list:
{
  "name": "Custom Docs",
  "source_type": "docs", 
  "docs_format": "html",
  "url": "https://docs.example.com",
  "doc_urls": [
    "https://docs.example.com/intro",
    "https://docs.example.com/guide"
  ]
}

OpenAPI Specifications

{
  "name": "Stripe API",
  "source_type": "docs",
  "docs_format": "openapi",
  "url": "https://raw.githubusercontent.com/stripe/openapi/master/openapi/spec3.json"
}

Source Status

StatusDescription
pendingSource created but never synced
syncingSync job currently running
syncedSuccessfully synced
errorLast sync failed

API Operations

Create Source

curl -X POST https://api.trygroundai.com/sources \
  -H "Authorization: Bearer gnd_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "My Source",
    "source_type": "repo",
    "url": "https://github.com/org/repo"
  }'

List Sources

curl https://api.trygroundai.com/sources \
  -H "Authorization: Bearer gnd_your_api_key"

Get Source

curl https://api.trygroundai.com/sources/{source_id} \
  -H "Authorization: Bearer gnd_your_api_key"

Update Source

curl -X PATCH https://api.trygroundai.com/sources/{source_id} \
  -H "Authorization: Bearer gnd_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{"name": "Updated Name"}'

Delete Source

curl -X DELETE https://api.trygroundai.com/sources/{source_id} \
  -H "Authorization: Bearer gnd_your_api_key"

Trigger Sync

curl -X POST https://api.trygroundai.com/sources/{source_id}/sync \
  -H "Authorization: Bearer gnd_your_api_key"

Best Practices

Filter out generated files, tests, and dependencies to keep the index focused and efficient.
Keep your sources fresh by syncing regularly. Stale sources show warnings in search results.
OpenAPI specs provide structured, version-tracked API information that’s easier to search accurately.