Retrieve a paginated list of documents for the authenticated organization.
from agentset import Agentset
with Agentset(
namespace_id="ns_123",
x_tenant_id="<id>",
token="AGENTSET_API_KEY",
) as a_client:
res = a_client.documents.list(order_by="createdAt", order="desc", cursor_direction="forward", per_page=30)
while res is not None:
# Handle items
res = res.next()
models.ListDocumentsResponse
| Error Type |
Status Code |
Content Type |
| errors.BadRequestError |
400 |
application/json |
| errors.UnauthorizedError |
401 |
application/json |
| errors.ForbiddenError |
403 |
application/json |
| errors.NotFoundError |
404 |
application/json |
| errors.ConflictError |
409 |
application/json |
| errors.InviteExpiredError |
410 |
application/json |
| errors.UnprocessableEntityError |
422 |
application/json |
| errors.RateLimitExceededError |
429 |
application/json |
| errors.InternalServerError |
500 |
application/json |
| errors.AgentsetDefaultError |
4XX, 5XX |
*/* |
Retrieve the info for a document.
from agentset import Agentset
with Agentset(
namespace_id="ns_123",
x_tenant_id="<id>",
token="AGENTSET_API_KEY",
) as a_client:
res = a_client.documents.get(document_id="doc_123")
# Handle response
print(res)
| Parameter |
Type |
Required |
Description |
Example |
document_id |
str |
✔️ |
The id of the document (prefixed with doc_) |
doc_123 |
x_tenant_id |
Optional[str] |
➖ |
Optional tenant id to use for the request. If not provided, the namespace will be used directly. Must be alphanumeric and up to 64 characters. |
|
retries |
Optional[utils.RetryConfig] |
➖ |
Configuration to override the default retry behavior of the client. |
|
models.GetDocumentResponse
| Error Type |
Status Code |
Content Type |
| errors.BadRequestError |
400 |
application/json |
| errors.UnauthorizedError |
401 |
application/json |
| errors.ForbiddenError |
403 |
application/json |
| errors.NotFoundError |
404 |
application/json |
| errors.ConflictError |
409 |
application/json |
| errors.InviteExpiredError |
410 |
application/json |
| errors.UnprocessableEntityError |
422 |
application/json |
| errors.RateLimitExceededError |
429 |
application/json |
| errors.InternalServerError |
500 |
application/json |
| errors.AgentsetDefaultError |
4XX, 5XX |
*/* |
Delete a document for the authenticated organization.
from agentset import Agentset
with Agentset(
namespace_id="ns_123",
x_tenant_id="<id>",
token="AGENTSET_API_KEY",
) as a_client:
res = a_client.documents.delete(document_id="doc_123")
# Handle response
print(res)
| Parameter |
Type |
Required |
Description |
Example |
document_id |
str |
✔️ |
The id of the document (prefixed with doc_) |
doc_123 |
x_tenant_id |
Optional[str] |
➖ |
Optional tenant id to use for the request. If not provided, the namespace will be used directly. Must be alphanumeric and up to 64 characters. |
|
retries |
Optional[utils.RetryConfig] |
➖ |
Configuration to override the default retry behavior of the client. |
|
models.DeleteDocumentResponse
| Error Type |
Status Code |
Content Type |
| errors.BadRequestError |
400 |
application/json |
| errors.UnauthorizedError |
401 |
application/json |
| errors.ForbiddenError |
403 |
application/json |
| errors.NotFoundError |
404 |
application/json |
| errors.ConflictError |
409 |
application/json |
| errors.InviteExpiredError |
410 |
application/json |
| errors.UnprocessableEntityError |
422 |
application/json |
| errors.RateLimitExceededError |
429 |
application/json |
| errors.InternalServerError |
500 |
application/json |
| errors.AgentsetDefaultError |
4XX, 5XX |
*/* |
Get a presigned download URL for a document's chunks. Only available for completed documents.
from agentset import Agentset
with Agentset(
namespace_id="ns_123",
token="AGENTSET_API_KEY",
) as a_client:
res = a_client.documents.get_chunks_download_url(document_id="doc_123")
# Handle response
print(res)
| Parameter |
Type |
Required |
Description |
Example |
document_id |
str |
✔️ |
The id of the document (prefixed with doc_) |
doc_123 |
retries |
Optional[utils.RetryConfig] |
➖ |
Configuration to override the default retry behavior of the client. |
|
models.GetChunksDownloadURLResponse
| Error Type |
Status Code |
Content Type |
| errors.BadRequestError |
400 |
application/json |
| errors.UnauthorizedError |
401 |
application/json |
| errors.ForbiddenError |
403 |
application/json |
| errors.NotFoundError |
404 |
application/json |
| errors.ConflictError |
409 |
application/json |
| errors.InviteExpiredError |
410 |
application/json |
| errors.UnprocessableEntityError |
422 |
application/json |
| errors.RateLimitExceededError |
429 |
application/json |
| errors.InternalServerError |
500 |
application/json |
| errors.AgentsetDefaultError |
4XX, 5XX |
*/* |
Get a presigned download URL for a document's source file. Only available for documents with source type MANAGED_FILE.
from agentset import Agentset
with Agentset(
namespace_id="ns_123",
token="AGENTSET_API_KEY",
) as a_client:
res = a_client.documents.get_file_download_url(document_id="doc_123")
# Handle response
print(res)
| Parameter |
Type |
Required |
Description |
Example |
document_id |
str |
✔️ |
The id of the document (prefixed with doc_) |
doc_123 |
retries |
Optional[utils.RetryConfig] |
➖ |
Configuration to override the default retry behavior of the client. |
|
models.GetFileDownloadURLResponse
| Error Type |
Status Code |
Content Type |
| errors.BadRequestError |
400 |
application/json |
| errors.UnauthorizedError |
401 |
application/json |
| errors.ForbiddenError |
403 |
application/json |
| errors.NotFoundError |
404 |
application/json |
| errors.ConflictError |
409 |
application/json |
| errors.InviteExpiredError |
410 |
application/json |
| errors.UnprocessableEntityError |
422 |
application/json |
| errors.RateLimitExceededError |
429 |
application/json |
| errors.InternalServerError |
500 |
application/json |
| errors.AgentsetDefaultError |
4XX, 5XX |
*/* |