✨ Feature Request: API Access to Retrieve Private Markdown Documents Securely

Open
#682 10 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
25/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Stale
Tech stack
django, python, react

Research direction

Start by reviewing the existing account settings and authentication entry points, then inspect how documents and permissions are exposed in the application. Define the token-management flow and the two proposed endpoints, including the Markdown versus ProseMirror/BlockNote JSON response choice. Done means securely generated tokens, permission-scoped document access, and documented curl examples for listing and retrieving documents.

Written by the indexing model from the issue text.

Description

Title: Feature Request: Simple Token-Based API Access for Private Documents (Initial Phase)

Feature Request

Is your feature request related to a problem or unsupported use case? Please describe.
Currently, users cannot programmatically retrieve their private documents from Docs without manual intervention. This prevents automation of workflows like backups, content integration, or syncing with external tools while keeping documents private.

Describe the solution you'd like
A minimal, secure API to retrieve documents privately, inspired by Grist’s simplicity:

  1. Token Generation:

    • Users can generate a personal API token in their account settings (e.g., under "API Tokens" or "Integrations").
    • Example UI: A button to "Generate new token" with a clear warning about token security.
  2. Endpoints:

    • List Documents:

      GET /api/documents  
      

      Returns a simple JSON list of documents the user has access to, with metadata (e.g., id, title, last_modified).

    • Get Document Content:

      GET /api/documents/{document_id}  
      

      Returns the document’s content in Markdown (or raw JSON/HTML if Markdown conversion is complex).

  3. Authentication:

    • Token sent via Authorization: Bearer {token} header.
    • Tokens inherit the user’s permissions (e.g., only documents they can view are accessible).

Drawbacks:

  • Minimal filtering/pagination for /api/documents initially (can be improved later).
  • No support for bulk exports or formats like PDF in this phase.

Describe alternatives you've considered

  • Manual UI Exports: Not scalable for automation.
  • Web Scraping: Fragile and insecure.
  • Complex API Design: Overkill for initial use cases. A minimal MVP aligns better with user needs.

Discovery, Documentation, Adoption, Migration Strategy

  • Discovery: Users find the token generator in their profile/account settings.

  • Documentation Example:

    ### Retrieve Documents via API (Beta)  
    1. **Generate a token**:  
       Go to **Account Settings → API Tokens → Generate Token**.  
    
    2. **List your documents**:  
       ```bash  
       curl -H "Authorization: Bearer YOUR_TOKEN" https://{instance}/api/documents  
    
    1. Get a document:
      curl -H "Authorization: Bearer YOUR_TOKEN" https://{instance}/api/documents/DOCUMENT_ID  
      
  • Adoption: Announce this as a beta feature for developers/automation enthusiasts.

  • Security Note: Advise users to store tokens securely and rotate them periodically.

Do you want to work on it through a Pull Request?
Yes, I’d like to collaborate on this after aligning with maintainers on:

  • Token storage/management implementation (e.g., Django REST Framework Token).
  • Preferred response format (Markdown vs. existing Prosemirror/BlockNote JSON).

Image

Dominant language
Python
Stars
16.8k
Forks
638
Avg merge
1d 15h
Merged PRs (30d)
40

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from suitenumerique/docs

All issues in suitenumerique/docs

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.