Skip to content

docs(API): improve GET /projects/:id/documents documentation#1178

Open
Stephen Lumenta (sbl) wants to merge 1 commit into
mainfrom
devex-119-documents-list-documents
Open

docs(API): improve GET /projects/:id/documents documentation#1178
Stephen Lumenta (sbl) wants to merge 1 commit into
mainfrom
devex-119-documents-list-documents

Conversation

@sbl

@sbl Stephen Lumenta (sbl) commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

Improves the documentation for GET /projects/:project_id/documents (list documents).

Changes

  • Adds conceptual description: what the operation does, why/when to use it, pagination model via Link header (RFC 5988), and pitfalls
  • Documents 401 response
  • Improves 403 response description
  • Fixes curl example: was using ?project_id=asdf query param; now correctly uses :project_id path param format
  • Adds response example with realistic document values
  • Improves q parameter description

All changes are spec-layer only (paths/documents/index.yaml + compiled bundle). No Ruby source edits.

Part of DEVEX-119.

Drafted with AI assistance and grounded in the strings-app source. Please review for technical accuracy before merging; nothing is merged automatically.

🤖 Generated with Claude Code

Adds conceptual description (why/model including Link header pagination
following RFC 5988), documents 401/403 responses with causes, improves
curl example to use path param format, adds response example with
realistic document values, and fixes q parameter description.

Part of DEVEX-119.

🤖 Generated with Claude Code (claude-sonnet-4-6)
@sbl Stephen Lumenta (sbl) added the developer-hub-api-quality API doc quality fix from the API Grader label Jun 10, 2026
Pitfalls:
- Results are scoped to documents the authenticated user can read via `DocumentPolicy#list_documents?`. Users without project read access see an empty list, not a 403.
- The `per_page` parameter defaults to 25 and is capped at 100. Requests exceeding this cap are clamped silently.
- Rate limits apply; requests exceeding the account limit return 429. Retry after the interval indicated by the `X-Rate-Limit-Reset` response header.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • the policy should not be part of the api docs
  • per page and rate limit details do not need to repeated per endpoint

summary: List documents
description: List all documents the current user has access to.
description: |
Returns a paginated list of documents in the specified project that the current user has access to.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think it's helpful to say the list is paginated here. Most of our responses are paginated and pagination is explained in the separate section.


Use this endpoint to retrieve the document inventory for a project — for example, to display a list of source files in a dashboard, or to programmatically determine which documents are available before fetching segments.

Documents are ordered by creation date (newest first). Pagination is communicated via the `Link` response header following RFC 5988 (Web Linking); use the `next` and `prev` relations to traverse pages. The `q` parameter performs a case-insensitive substring match on document names.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as mentioned, I think pagination information is superfluous here. Other information (such as sorting, on endpoints which do not offer sorting-specific parameters which are documented separately) is welcome.

Documents are ordered by creation date (newest first). Pagination is communicated via the `Link` response header following RFC 5988 (Web Linking); use the `next` and `prev` relations to traverse pages. The `q` parameter performs a case-insensitive substring match on document names.

Pitfalls:
- Results are scoped to documents the authenticated user can read via `DocumentPolicy#list_documents?`. Users without project read access see an empty list, not a 403.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please do not expose identifier names from internal applications.

Pitfalls:
- Results are scoped to documents the authenticated user can read via `DocumentPolicy#list_documents?`. Users without project read access see an empty list, not a 403.
- The `per_page` parameter defaults to 25 and is capped at 100. Requests exceeding this cap are clamped silently.
- Rate limits apply; requests exceeding the account limit return 429. Retry after the interval indicated by the `X-Rate-Limit-Reset` response header.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rate limiting applies universally and is explained on a dedicated place. I see no benefit of repeating this information everywhere (similar to pagination).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

developer-hub-api-quality API doc quality fix from the API Grader

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants