Basecamp API

repository·master·Indexed 20 days ago

https://github.com/basecamp/bc-api

A RESTful interface for integrating with Basecamp projects to manage resources such as to-dos, messages, and documents. The API uses OAuth 2.0 for authentication, employs a 'flat route' architecture for resource access, and exclusively uses JSON for data exchange. It includes detailed specifications for handling pagination via Link headers, HTTP caching with ETags, rate limiting, and the Basecamp domain model consisting of Buckets, Recordings, and Docks.

Tokens
104.2K
Snippets
336
Records
403
Agent score
69%

What's inside bc-api

  1. Understand the structure of a User object

    master

    The User object represents a person in Basecamp. It is used in various contexts, such as the creator of a todo or an entry in the assignees list.

    Key fields include:

    • id: The unique identifier for the user.
    • name: The user's full name.
    • email_address: The user's email.
    • personable_type: Always User.
    • attachable_sgid: A secure global ID used for referencing the user in other parts of the API.
    • company: An object containing the user's id and name of their company.
    • avatar_url: A URL to the user's profile image.
    {
      "id": 1049715939,
      "name": "Cheryl Walters",
      "email_address": "cheryl@honchodesign.com",
      "personable_type": "User",
      "attachable_sgid": "BAh7BkkiC19yYWlscwY6BkVUewdJIglkYXRhBjsAVEkiK2dpZDovL2JjMy9QZXJzb24vMTA0OTcxNTkzOT9leHBpcmVzX2luBjsAVEkiCHB1cgY7AFRJIg9hdHRhY2hhYmxlBjsAVA==--91bd4d39e2f4af1d814a0b480e809d15a51df239",
      "company": {
        "id": 1033447817,
        "name": "Honcho Design"
      }
    }
  2. Examine the User object within Todos

    master

    When accessing assignees or creator fields in a Todo, you receive a User object containing:

    • id: Unique user identifier.
    • name: Full name of the user.
    • email_address: User's email.
    • personable_type: Always User for these objects.
    • attachable_sgid: A secure global ID used for attaching the user to other resources.
    • avatar_url: Link to the user's profile image.
    • can_manage_projects, can_manage_people, etc.: Boolean permissions for the user.
    {
      "id": 1049715938,
      "name": "Annie Bryan",
      "personable_type": "User",
      "email_address": "annie@honchodesign.com",
      "avatar_url": "https://3.basecampapi.com/195539477/people/.../avatar"
    }
  3. How to work with Basecamp rich text HTML

    master

    Basecamp represents content for resources like messages, documents, and comments as rich text in HTML.

    Reading rich text

    • Rendering: Use a web view component to render the HTML unmodified.
    • Plain-text conversion: To get a plain-text version, decode HTML entities, replace <br> tags with line breaks, and then strip all remaining HTML tags.

    Writing rich text

    • Requirements: You must generate well-formed HTML, properly encoding HTML entities and replacing line breaks with <br> tags.
    • Modifying existing content: Use a full HTML parser (like Nokogiri for Ruby or Cheerio for Node.js) to ensure you do not discard formatting or attachments during manipulation.
  4. Understand the structure of a Timeline event

    master

    A Timeline event is a JSON object representing an action taken within Basecamp. Each event contains metadata about the action, the actor, and the context.

    Key fields in a timeline event include:

    • id: Unique identifier for the event.
    • kind: The type of event (e.g., todo_created, dock_created, google_document_created, project_started).
    • created_at: Timestamp of the event.
    • creator: An object containing details about the person who performed the action (name, email, title, etc.).
    • action: A human-readable string describing the action (e.g., "Victor C. added a to-do").
    • target: The name of the object affected by the action.
    • title: A formatted string summarizing the event.
    • bucket: Information about the project or bucket where the event occurred, including its id, name, and URLs.
    • url / app_url: API and web links to the specific resource related to the event.
    • summary_excerpt: A short text snippet providing context for the action, if available.
    {
      "id": 1052473913,
      "created_at": "2026-07-21T00:05:14.877Z",
      "kind": "todo_created",
      "creator": {
        "id": 1049715913,
        "name": "Victor Cooper",
        "email_address": "victor@honchodesign.com"
      },
      "action": "Victor C. added a to-do",
      "target": "First things first",
      "title": "On “First things first”, Victor C. added",
      "summary_excerpt": "Talk to Cheryl about benefits",
      "bucket": {
        "id": 2085958513,
        "name": "New project from template"
      }
    }
  5. How webhooks work in Basecamp

    master

    Basecamp webhooks notify your application via HTTPS when specific events occur. A webhook is configured with a payload_url (must be HTTPS) and a list of types that trigger the calls.

    Delivery Behavior:

    • Basecamp attempts to call the URL up to 10 times with exponential backoff before deactivating the webhook.
    • A successful response is defined as any HTTP status code in the 2xx range.
    • Basecamp will not follow 3xx redirects.
    • For debugging, Basecamp maintains a delivery record containing the full request and response for the 25 most recent delivery attempts.

    Status Propagation Note: As of July 1, 2024, Basecamp does not notify of changes that are automatically propagated to children (e.g., archiving a Todolist will only trigger a webhook for the parent Todolist, not for the individual Todos or Comments inside it).

  6. Understand Basecamp Tools and the Dock

    master

    Tools are the specific features available within a project's 'dock' (e.g., Message Board, To-dos, Docs & Files, Campfire, Schedule).

    To discover which tools are currently in a project, inspect the dock array in the response from the [Get a project] endpoint. Each entry in the dock array provides:

    • id: The unique identifier for the tool.
    • name: The tool's name.
    • title: The display title.
    • enabled: The current status of the tool.
    • position: The tool's order in the dock.
  7. How Project Construction works

    master

    To create a new project based on a Template, you must initiate a Project Construction. This is an asynchronous process.

    1. Initiate: Send a POST request to /templates/:template_id/project_constructions.json with the project name and optional description wrapped in a project object.
    2. Poll: The initial response returns a status of pending and a url for the construction resource. You should poll this endpoint at regular intervals (no more than once per second).
    3. Complete: Once the construction is finished, the status will change to completed, and the response will include the full JSON representation of the newly created project.
    # 1. Create the construction
    curl -s -H "Authorization: Bearer $ACCESS_TOKEN" -H "Content-Type: application/json" -d '{"project":{"name":"Marketing Campaign","description":"For Client: Xyz Corp Conference"}}' -X POST https://3.basecampapi.com/$ACCOUNT_ID/templates/2085958507/project_constructions.json
    
    # 2. Poll the construction URL (example ID 598194962)
    curl -s -H "Authorization: Bearer $ACCESS_TOKEN" https://3.basecampapi.com/$ACCOUNT_ID/templates/2085958507/project_constructions/598194962.json
  8. Access structured attachment metadata

    master

    Every rich text attribute in an API response (e.g., content, description) is accompanied by a corresponding *_attachments array. This array contains structured metadata for every downloadable file attachment embedded in the HTML.

    Note: This array includes only downloadable file attachments. It excludes mentions, content attachments, remote images, and opengraph embeds. The array is always present, even if empty.

    Common mapping:

    • content $\rightarrow$ content_attachments
    • description $\rightarrow$ description_attachments

    Metadata fields per entry:

    • id
    • sgid
    • filename
    • content_type
    • byte_size
    • download_url
    • width
    • height
    • previewable
    • preview_url
    • thumbnail_url
  9. What are Recordings in the Basecamp API

    master
    In the Basecamp 5 API, most data structures are represented as "Recordings". This abstraction allows you to perform generic actions (like archiving, trashing, or unarchiving) across different types of content using a unified set of endpoints.
  10. Handle pagination using Link headers

    master

    Most collection APIs are paginated using a geared ratio (15 results on page 1, 30 on page 2, 50 on page 3, and 100 on page 4+).

    Do not construct pagination URLs manually. Instead, follow the RFC5988 convention by using the Link header provided in the response to find the URL for the next page. If the Link header is absent, you have reached the last page.

    The API also provides an X-Total-Count header indicating the total number of resources in the collection.

    Link: <https://3.basecampapi.com/999999999/message_boards/3/messages.json?page=4>; rel="next"
  11. How Gauges and Gauge Needles work

    master

    Gauges visualize project progress using a needle position (0–100), a color indicator (green, yellow, or red), and an optional description.

    Key Concepts:

    • Automatic Creation: Gauges are automatically created when a project is created. You can check for gauge data in a project response by looking for last_needle_color and last_needle_position.
    • History via Needles: Each time progress is recorded, a new gauge needle is created. This preserves a history of updates rather than just overwriting a single value.
    • Immutability: In a gauge needle, the position and color are immutable after creation. To record a new progress update, you must create a new gauge needle instead of updating an existing one. Only the description can be updated on an existing needle.