API Reference

Sources

Add and manage the training sources that power an agent.

List sources

Lists an agent's sources, newest first. Draft sources are excluded.

Scope: source:read · Rate limit: Read (120/min)

GET/agents/{agent}/sources
AuthorizationBearer <token>

Bearer API key. Create one in your dashboard (Settings → API Keys); the full value is shown only once. Requires the organization owner on a premium or active AppSumo plan.

In: header

Path Parameters

agentstring

The agent's UUID.

Formatuuid

Query Parameters

type?string

Filter by source type.

Value in"text" | "qa" | "url" | "file"
status?string

Filter by training status.

Value in"pending" | "processing" | "completed" | "failed"
page?integer

Page number.

Default1
Range1 <= value
per_page?integer

Items per page.

Default25
Range1 <= value <= 100

Response Body

curl -X GET "https://api.assistloop.ai/api/public/v1/agents/497f6eca-6276-4993-bfeb-53cbbbba6f08/sources?type=text&status=pending&page=1&per_page=25"
{
  "data": [
    {
      "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
      "type": "text",
      "title": "string",
      "status": "pending",
      "is_draft": true,
      "task_id": "string",
      "created_at": "2019-08-24T14:15:22Z",
      "updated_at": "2019-08-24T14:15:22Z"
    }
  ],
  "meta": {
    "current_page": 0,
    "per_page": 0,
    "total": 0,
    "last_page": 0,
    "request_id": "266ea41d-adf5-480b-af50-15b940c2b846"
  },
  "links": {
    "first": "string",
    "last": "string",
    "prev": "string",
    "next": "string"
  }
}
{
  "message": "Unauthenticated."
}
{
  "error": {
    "code": "insufficient_scope",
    "message": "Token is missing required scope: source:create",
    "details": []
  },
  "meta": {
    "request_id": "b7f0b9c2-1a2b-4c3d-8e9f-0a1b2c3d4e5f"
  }
}

Create a source

Creates a source and dispatches its training job. The required body depends on the type field. text, qa, and url use JSON; file uses multipart/form-data. A url request creates one source per URL and returns an array.

If the agent is disabled, returns 423 agent_unavailable. Quota overruns (text size, URL count, or document bytes) return 422 subscription_limit_exceeded.

Scope: source:create · Rate limit: Training (20/min)

POST/agents/{agent}/sources
AuthorizationBearer <token>

Bearer API key. Create one in your dashboard (Settings → API Keys); the full value is shown only once. Requires the organization owner on a premium or active AppSumo plan.

In: header

Path Parameters

agentstring

The agent's UUID.

Formatuuid
typestring
contentstring

The text to train on.

Lengthlength <= 50000
title?string

Optional; auto-generated from the content when omitted.

Lengthlength <= 255
typestring
questionsarray<object>
typestring
urlsarray<string>

Response Body

curl -X POST "https://api.assistloop.ai/api/public/v1/agents/497f6eca-6276-4993-bfeb-53cbbbba6f08/sources" \  -H "Content-Type: application/json" \  -d '{    "type": "text",    "title": "Refund policy",    "content": "Customers may request a refund within 30 days of purchase..."  }'
{
  "data": {
    "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
    "type": "text",
    "title": "string",
    "status": "pending",
    "is_draft": true,
    "task_id": "string",
    "created_at": "2019-08-24T14:15:22Z",
    "updated_at": "2019-08-24T14:15:22Z"
  },
  "meta": {
    "request_id": "266ea41d-adf5-480b-af50-15b940c2b846"
  }
}
{
  "message": "Unauthenticated."
}
{
  "error": {
    "code": "insufficient_scope",
    "message": "Token is missing required scope: source:create",
    "details": []
  },
  "meta": {
    "request_id": "b7f0b9c2-1a2b-4c3d-8e9f-0a1b2c3d4e5f"
  }
}

{
  "error": {
    "code": "validation_failed",
    "message": "The content field is required.",
    "details": [
      {
        "field": "content",
        "message": "The content field is required."
      }
    ]
  },
  "meta": {
    "request_id": "b7f0b9c2-1a2b-4c3d-8e9f-0a1b2c3d4e5f"
  }
}

{
  "error": {
    "code": "agent_unavailable",
    "message": "Agent is currently disabled.",
    "details": []
  },
  "meta": {
    "request_id": "b7f0b9c2-1a2b-4c3d-8e9f-0a1b2c3d4e5f"
  }
}
{
  "error": {
    "code": "upstream_failure",
    "message": "Could not complete the request upstream.",
    "details": []
  },
  "meta": {
    "request_id": "b7f0b9c2-1a2b-4c3d-8e9f-0a1b2c3d4e5f"
  }
}

Retrieve a source

The source must belong to the agent, otherwise 404 resource_not_found.

Scope: source:read · Rate limit: Read (120/min)

GET/agents/{agent}/sources/{source}
AuthorizationBearer <token>

Bearer API key. Create one in your dashboard (Settings → API Keys); the full value is shown only once. Requires the organization owner on a premium or active AppSumo plan.

In: header

Path Parameters

agentstring

The agent's UUID.

Formatuuid
sourcestring

The source's UUID. Must belong to the agent in the path.

Formatuuid

Response Body

curl -X GET "https://api.assistloop.ai/api/public/v1/agents/497f6eca-6276-4993-bfeb-53cbbbba6f08/sources/497f6eca-6276-4993-bfeb-53cbbbba6f08"
{
  "data": {
    "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
    "type": "text",
    "title": "string",
    "status": "pending",
    "is_draft": true,
    "task_id": "string",
    "created_at": "2019-08-24T14:15:22Z",
    "updated_at": "2019-08-24T14:15:22Z"
  },
  "meta": {
    "request_id": "266ea41d-adf5-480b-af50-15b940c2b846"
  }
}
{
  "message": "Unauthenticated."
}
{
  "error": {
    "code": "insufficient_scope",
    "message": "Token is missing required scope: source:create",
    "details": []
  },
  "meta": {
    "request_id": "b7f0b9c2-1a2b-4c3d-8e9f-0a1b2c3d4e5f"
  }
}
{
  "error": {
    "code": "resource_not_found",
    "message": "Source not found.",
    "details": []
  },
  "meta": {
    "request_id": "b7f0b9c2-1a2b-4c3d-8e9f-0a1b2c3d4e5f"
  }
}

Delete a source

Deletes the source, removes its file from storage (for file sources), and removes its embedded document from the training index. Deleting on a disabled agent returns 423 agent_unavailable.

Scope: source:delete · Rate limit: Write (60/min)

DELETE/agents/{agent}/sources/{source}
AuthorizationBearer <token>

Bearer API key. Create one in your dashboard (Settings → API Keys); the full value is shown only once. Requires the organization owner on a premium or active AppSumo plan.

In: header

Path Parameters

agentstring

The agent's UUID.

Formatuuid
sourcestring

The source's UUID. Must belong to the agent in the path.

Formatuuid

Response Body

curl -X DELETE "https://api.assistloop.ai/api/public/v1/agents/497f6eca-6276-4993-bfeb-53cbbbba6f08/sources/497f6eca-6276-4993-bfeb-53cbbbba6f08"
Empty
{
  "message": "Unauthenticated."
}
{
  "error": {
    "code": "insufficient_scope",
    "message": "Token is missing required scope: source:create",
    "details": []
  },
  "meta": {
    "request_id": "b7f0b9c2-1a2b-4c3d-8e9f-0a1b2c3d4e5f"
  }
}
{
  "error": {
    "code": "resource_not_found",
    "message": "Source not found.",
    "details": []
  },
  "meta": {
    "request_id": "b7f0b9c2-1a2b-4c3d-8e9f-0a1b2c3d4e5f"
  }
}
{
  "error": {
    "code": "agent_unavailable",
    "message": "Agent is currently disabled.",
    "details": []
  },
  "meta": {
    "request_id": "b7f0b9c2-1a2b-4c3d-8e9f-0a1b2c3d4e5f"
  }
}
{
  "error": {
    "code": "upstream_failure",
    "message": "Could not complete the request upstream.",
    "details": []
  },
  "meta": {
    "request_id": "b7f0b9c2-1a2b-4c3d-8e9f-0a1b2c3d4e5f"
  }
}