Skip to main content

Sources API

Create, read, update, and delete sources.

Create Source

name
string
required
Human-readable name for the source
source_type
string
required
Source type: repo or docs
url
string
required
Git URL for repos, base URL or spec URL for docs
branch
string
Git branch (repos only, default: main)
docs_format
string
Docs format: html or openapi (default: html)
doc_urls
string[]
Explicit URL list for HTML docs
use_sitemap
boolean
Use sitemap for URL discovery (HTML docs only)
include_patterns
string[]
Glob patterns to include
exclude_patterns
string[]
Glob patterns to exclude
curl -X POST https://api.trygroundai.com/sources \
  -H "Authorization: Bearer gnd_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "My API",
    "source_type": "docs",
    "docs_format": "openapi",
    "url": "https://api.example.com/openapi.json"
  }'
{
  "id": "550e8400-e29b-41d4-a716-446655440000",
  "name": "My API",
  "source_type": "docs",
  "status": "pending",
  "url": "https://api.example.com/openapi.json",
  "docs_format": "openapi",
  "file_count": 0,
  "chunk_count": 0,
  "created_at": "2026-01-17T10:00:00Z",
  "updated_at": "2026-01-17T10:00:00Z"
}

List Sources

curl "https://api.trygroundai.com/sources?skip=0&limit=50"
{
  "sources": [
    {
      "id": "...",
      "name": "My API",
      "source_type": "docs",
      "status": "synced",
      "url": "https://api.example.com/openapi.json",
      "docs_format": "openapi",
      "file_count": 45,
      "chunk_count": 45,
      "last_sync_completed": "2026-01-17T10:05:00Z",
      "created_at": "2026-01-17T10:00:00Z",
      "updated_at": "2026-01-17T10:05:00Z"
    }
  ],
  "total": 1
}

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",
    "include_patterns": ["*.py"]
  }'

Delete Source

Deletes the source and all its indexed content.
curl -X DELETE https://api.trygroundai.com/sources/{source_id} \
  -H "Authorization: Bearer gnd_your_api_key"

Trigger Sync

Starts a background job to sync the source.
curl -X POST https://api.trygroundai.com/sources/{source_id}/sync \
  -H "Authorization: Bearer gnd_your_api_key"
{
  "job_id": "job-uuid",
  "source_id": "source-uuid",
  "message": "Sync job started"
}
Returns 409 Conflict if a sync is already running for this source.