Skip to content

Project documents

project_documents

Project documents resource group.

Wraps three endpoints for plain-text project documents (custom instructions, reference material attached to a project):

  • GET /v1/compliance/apps/projects/documents/{document_id} — fetch one document including its text content.
  • GET /v1/compliance/apps/projects/documents/{document_id}/metadata — fetch the same document's metadata without its body, which is what you want when enumerating rather than exporting.
  • DELETE /v1/compliance/apps/projects/documents/{document_id} — hard-delete a document.

The list-of-documents view lives on the parent project — call list_attachments and filter by type == "project_doc". The discriminator returns both binary files (project_file) and documents (project_doc) because the API lists them on the same endpoint.

ProjectDocument dataclass

The full content of one project document.

Attributes:

Name Type Description
id str

Tagged document identifier (claude_proj_doc_...).

filename str

Display name (e.g. "instructions.txt").

content str

Document body, as plain text.

created_at str

RFC 3339 creation timestamp.

user dict[str, Any] | None

Creator info (id, email_address) or None when the creator's account has been deleted. Kept as a raw dict.

extra dict[str, Any]

Any additional fields the API adds in a later revision.

from_dict classmethod

from_dict(body: Mapping[str, Any]) -> 'ProjectDocument'

Build a ProjectDocument from one decoded record.

ProjectDocumentMetadata dataclass

One project document's metadata, without its body.

Use this to enumerate documents cheaply. get returns the same document with its text, which means pulling every body just to read a filename or a size.

Attributes:

Name Type Description
id str

Tagged document identifier (claude_proj_doc_...).

claude_project_id str

The project the document belongs to.

filename str

Display name.

mime_type str

Always "text/plain" — project documents are stored as text, including ones converted from other formats when they were added.

size_bytes int | None

Size of the stored text.

md5 str | None

Lowercase hex MD5 of the stored text.

created_at str

RFC 3339 creation timestamp.

user dict[str, Any] | None

Creator info (id, email_address) or None when the creator's account has been deleted. Kept as a raw dict.

extra dict[str, Any]

Any additional fields the API adds in a later revision.

from_dict classmethod

from_dict(
    body: Mapping[str, Any]
) -> "ProjectDocumentMetadata"

Build a ProjectDocumentMetadata from one decoded record.

ProjectDocuments

Synchronous client for the Project Documents endpoints.

get

get(document_id: str) -> ProjectDocument

Fetch one project document, content included.

Parameters:

Name Type Description Default
document_id str

Tagged document identifier (e.g. the id from an attachment with type == "project_doc").

required

Raises:

Type Description
NotFoundError

When document_id does not exist or has already been deleted.

APIError

For any other non-2xx response.

get_metadata

get_metadata(document_id: str) -> ProjectDocumentMetadata

Fetch one project document's metadata, without its body.

Parameters:

Name Type Description Default
document_id str

Tagged document identifier.

required

Raises:

Type Description
NotFoundError

When document_id does not exist or has already been deleted.

APIError

For any other non-2xx response.

delete

delete(document_id: str) -> None

Hard-delete a project document.

Returns None on success; the server's confirmation payload is discarded.

Raises:

Type Description
NotFoundError

When document_id does not exist.

APIError

For any other non-2xx response.

AsyncProjectDocuments

Asynchronous client for the Project Documents endpoints.

get async

get(document_id: str) -> ProjectDocument

Async analogue of get.

get_metadata async

get_metadata(document_id: str) -> ProjectDocumentMetadata

Async analogue of get_metadata.

delete async

delete(document_id: str) -> None

Async analogue of delete.