Create a data source
Add a website or webpage as a knowledge source. Upload sources are dashboard-only; connector sources auto-create with the integration.
Create a website or webpage knowledge source. Indexing happens asynchronously, the response returns sync_status: "fetching" and the agent's search_knowledge tool becomes useful once sync_status: "ready".
Scope: sources:write
Request body
| Field | Type | Required | Notes |
|---|---|---|---|
type | enum | yes | "website" or "webpage". upload returns 409 (singleton already exists); connector returns 422 (auto-created with the integration). |
name | string | yes | Display name. |
config.url | string | yes | The starting URL. |
config.indexed | boolean | no | Default false. When true, content is chunked + embedded and becomes searchable via search_knowledge. |
Example: create a website source
curl -X POST https://dashboard.getmacha.com/api/v1/sources \
-H "Authorization: Bearer $MACHA_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: $(uuidgen)" \
-d '{
"type": "website",
"name": "Macha Help Center",
"config": {
"url": "https://www.getmacha.com/docs",
"indexed": true
}
}'
Example response (201)
{
"data": {
"id": "source_6a39a4f1c0ef2ec711ef6dc1",
"type": "website",
"name": "Macha Help Center",
"sync_status": "fetching",
"last_sync_at": null,
"document_count": null,
"is_active": true,
"created_at": "2026-06-24T10:42:00.000Z",
"updated_at": "2026-06-24T10:42:00.000Z"
},
"meta": { "request_id": "req_..." }
}
Polling for completion
async function waitForSync(sourceId) {
while (true) {
const res = await fetch(`https://dashboard.getmacha.com/api/v1/sources/${sourceId}`, {
headers: { Authorization: `Bearer ${process.env.MACHA_API_KEY}` }
});
const body = await res.json();
if (body.data.sync_status === 'ready') return body.data;
if (body.data.sync_status === 'error') throw new Error('Sync failed');
await new Promise(r => setTimeout(r, 5000));
}
}
Errors
| Status | Code | When |
|---|---|---|
409 | upload_source_exists | type=upload, the singleton is already provisioned. |
422 | validation_failed | Missing field, bad type, type=connector, plan limit reached. |
© 2026 AGZ Technologies Private Limited