### JavaScript Date Object Example Source: https://developer.clickup.com/docs/general-time This snippet demonstrates how to work with JavaScript Date objects, which is relevant for understanding ClickUp API date formatting. It shows how dates are represented and manipulated in JavaScript. ```JavaScript const date = new Date(); console.log(date.getTime()); // Milliseconds since epoch console.log(date.toISOString()); // ISO 8601 format ``` -------------------------------- ### Get Task Linked Tasks Example Source: https://developer.clickup.com/docs/tasks This example demonstrates how the ClickUp API returns linked tasks within the response body of a GET Task request. It shows the structure of the 'linked_tasks' array, including task ID, link ID, creation date, user ID, and workspace ID. ```json { "linked_tasks": [ { "task_id": "8xdfdjbgd", "link_id": "8xdfm9vmz", "date_created": "1744930048464", "userid": "395492", "workspace_id": "333" } ] } ``` -------------------------------- ### ClickUp API View Object Example Source: https://developer.clickup.com/docs/views An example JSON object representing a ClickUp view, demonstrating configurations for name, type, parent, grouping, filters, sorting, and columns. This structure is used when creating or updating views via the API. ```JSON { "name": "View Name", "type": "list", "parent": { "id": 333, "type": 7 }, "grouping": { "field": "status", "dir": 1 }, "filters": { "op": "AND", "fields": [ { "field": "assignee", "op": "EQ", "values": [] } ], "search": "", "show_closed": false }, "sorting": { "fields": [ { "field": "dateCreated", "dir": -1 } ] }, "columns": { "fields": [ { "field": "dateCreated" } ] } } ``` -------------------------------- ### ClickUp API v2 Demo Application Source: https://developer.clickup.com/docs/index A sample application demonstrating how to use the ClickUp API v2. This repository provides practical examples and guidance for integrating with ClickUp services. ```GitHub https://github.com/clickup/clickup-APIv2-demo ``` -------------------------------- ### Get Task Dependencies Source: https://developer.clickup.com/docs/tasks Retrieves task dependencies using the GET Task API. The response includes details about each dependency, such as task IDs, type, and creation date. ```JSON "dependencies": [ { "task_id": "8xdfm9vmz", "depends_on": "8xdfe67cz", "type": 1, "date_created": "1744930371817", "userid": "395492", "workspace_id": "333", "chain_id": null } ] ``` -------------------------------- ### Automation Call Webhook Legacy Payload Example Source: https://developer.clickup.com/docs/automationcallwebhooklegacypayload This snippet shows an example of the legacy webhook payload sent to your webhook URL when the 'Call webhook (Legacy) Action' is used within a ClickUp Automation. It illustrates the structure of data received for automation events. ```JSON { "history_items": [ { "id": "1677721600000000000", "task_id": "123456789", "user_id": 123456789, "type": "task_automation", "automation_type": "call_webhook", "automation_action": { "type": "call_webhook", "webhook_url": "https://example.com/webhook", "webhook_method": "POST", "webhook_payload": "{\"message\": \"Hello from ClickUp!\"}" }, "date_created": "1677721600000000000" } ] } ``` -------------------------------- ### Example Incoming Webhook Request Source: https://developer.clickup.com/docs/webhooks This snippet demonstrates the structure of an incoming webhook request to ClickUp, including the HTTP method, content type, and a sample JSON payload for a 'listUpdated' event. ```HTTP POST https://yourdomain.com/webhook Content-Type: application/json Body: { "event": "listUpdated", "history_items": [ { "id": "8a2f82db-7718-4fdb-9493-4849e67f009d", "type": 6, "date": "1642740510345", "source": null, "user": { "id": 183, "username": "John" }, "before": "webhook payloads 2", "after": "Webhook payloads round 2" } ], "list_id": "162641285", "webhook_id": "7fa3ec74-69a8-4530-a251-8a13730bd204" } ``` -------------------------------- ### ClickUp API v2 Demo - Subscribe to Webhooks Source: https://developer.clickup.com/docs/webhooks TypeScript code snippet from the ClickUp API v2 demo application demonstrating how to subscribe to webhooks. This example likely handles the logic for setting up webhook subscriptions. ```typescript https://github.com/clickup/clickup-APIv2-demo/blob/1f81edcb9f8be36b2f0d13441ce7f3638b1defa1/backend/src/routes/clickup.ts#L77 ``` -------------------------------- ### Automation Call Webhook Payload Example Source: https://developer.clickup.com/docs/automationwebhookpayload This is an example of the JSON payload that ClickUp sends to your webhook URL when an automation triggers the 'Call webhook' action. It contains details about the event, the workspace, and the specific data related to the automation. ```json { "event": "automation_webhook", "workspace_id": "12345678", "automation_id": "a1b2c3d4e5f6", "trigger_id": "t1a2b3c4d5e6", "task_id": "t7h8i9j0k1l2", "list_id": "l3m4n5o6p7q8", "folder_id": "f9r0s1t2u3v4", "space_id": "s5w6x7y8z9a0", "custom_fields": [ { "id": "cf_12345", "name": "Status", "type": "drop_down", "type_config": { "options": [ { "color": "#858585", "name": "To Do", "id": "option_1" }, { "color": "#2ecc71", "name": "In Progress", "id": "option_2" } ] }, "value": "option_2", "date_created": "1678886400000", "user_created": 1 } ], "task_name": "Update documentation", "task_url": "https://app.clickup.com/t/t7h8i9j0k1l2", "list_name": "Development", "folder_name": "Project X", "space_name": "Engineering" } ``` -------------------------------- ### Try ClickUp API Endpoints in Browser Source: https://developer.clickup.com/docs/trytheapi This section explains how to use the interactive 'Try It' panel available in the ClickUp API documentation to test endpoints directly from your web browser. It guides users through filling in parameters and authenticating requests using their personal API key. ```text 1. Navigate to any endpoint in the Reference section 2. Look for the "Try It" panel on the right side 3. Fill in the required parameters and customize optional ones in the API docs 4. Click "Try It" to make the request ``` -------------------------------- ### Authenticate with Personal Access Token Source: https://developer.clickup.com/docs/authentication Use a personal API token for individual or testing purposes. Personal tokens begin with `pk_`. Add the token to the header: `Authorization: {personal_token}`. This is also needed to use the Try-It feature in the API docs. ```HTTP Authorization: {personal_token} ``` -------------------------------- ### Accessing Spaces in API v2 (Team as Workspace) Source: https://developer.clickup.com/docs/general-v2-v3-api This example shows an API path for interacting with Spaces within a 'Team' in API v2. In v2, 'Team' is used to refer to what is now called a 'Workspace'. ```HTTP GET /api/v2/team/{team_id}/space ``` -------------------------------- ### Register Webhook for Task Events Source: https://developer.clickup.com/docs/webhooks Example JSON payload to register a webhook that subscribes to events for a specific Task. This configuration includes the Space, Folder, List, and Task IDs to pinpoint the exact resource. ```json { "space_id": 1234, "folder_id": 9876, "list_id": 4567, "task_id": "abc1234" } ``` -------------------------------- ### Accessing Docs in API v3 (Workspace) Source: https://developer.clickup.com/docs/general-v2-v3-api This example demonstrates an API path for accessing documents within a 'Workspace' in API v3. API v3 consistently uses 'Workspace' for the main organizational unit. ```HTTP GET /api/v3/workspaces/{workspace_id}/docs ``` -------------------------------- ### ClickUp API Custom Field Object Example Source: https://developer.clickup.com/docs/customfields This JSON object represents a Custom Field in ClickUp, as seen when using the Get Accessible Custom Fields endpoint. It includes the field's ID, name, type, configuration, creation date, and visibility settings. ```json { "id": "5dc86497-098d-4bb0-87d6-cf28e43812e7", "name": "Text Field", "type": "text", "type_config": {}, "date_created": "1577378759142", "hide_from_guests": false } ``` -------------------------------- ### Format Comment as Checklist Source: https://developer.clickup.com/docs/comment-formatting Provides an example of creating a checklist with checked and unchecked items in a comment using the ClickUp API. Different 'list' attribute values are used for checked and unchecked states. ```JSON { "comment": [ { "text": "Checklist", "attributes": {} }, { "text": "\n", "attributes": { "list": { "list": "unchecked" } } }, { "text": "Checked item", "attributes": {} }, { "text": "\n", "attributes": { "list": { "list": "checked" } } } ] } ``` -------------------------------- ### Configure Manual Progress Bar Source: https://developer.clickup.com/docs/customfields Sets up a manually controlled progress bar, defining the start, end, and current values. ClickUp displays the current value as a percentage of the total. ```JSON { "name": "Manual Progress Bar", "type": "progress", "type_config": { "method": "manual", "start": 0, "end": 100, "current": 50 } } ``` -------------------------------- ### Retrieve ClickUp Authorization Code Source: https://developer.clickup.com/docs/authentication This snippet shows the URL structure to send users to for authorizing their ClickUp account. It includes parameters for client ID and redirect URI, with an optional state parameter for security. ```URL https://app.clickup.com/api?client_id={client_id}&redirect_uri={redirect_uri} ``` ```URL https://app.clickup.com/api?client_id={client_id}&redirect_uri={redirect_uri}&state={state} ``` -------------------------------- ### Filter tasks by Custom Field - Example Query Source: https://developer.clickup.com/docs/taskfilters This example demonstrates how to construct a query parameter to filter tasks based on a Custom Field. It specifies the `field_id`, the `operator` (greater than), and the `value` for the filter. ```json ?custom_fields=[{"field_id":"de761538-8ae0-42e8-91d9-f1a0cdfbd8b5","operator":">","value":2},{...}] ``` -------------------------------- ### OAuth 2.0 Authentication Flow Source: https://developer.clickup.com/docs/authentication For apps or integrations that other people use, use the OAuth 2.0 flow, allowing users to authorize Workspaces for your app. ClickUp uses the Authorization Code grant type. ```OAuth Grant Type: Authorization Code Authorization URL: https://app.clickup.com/api Access Token URL: https://api.clickup.com/api/v2/oauth/token ``` -------------------------------- ### Register Webhook for List Events Source: https://developer.clickup.com/docs/webhooks Example JSON payload to register a webhook that subscribes to events for a specific List within a Space. This configuration targets a particular List ID and its parent Space ID. ```json { "space_id": 1234, "list_id": 4567 } ``` -------------------------------- ### Get List Members via API Source: https://developer.clickup.com/docs/faq This endpoint retrieves a list of team members who have access to a specific list. It is part of the 'Members' section in the API documentation. ```HTTP GET /api/v2/list/{{list_id}}/member ``` -------------------------------- ### Format Comment as Inline Code Source: https://developer.clickup.com/docs/comment-formatting Provides an example of how to format text as inline code within a comment using the ClickUp API. The 'code' attribute is set to true. ```JSON { "comment": [ { "text": "inline code", "attributes": { "code": true } } ] } ``` -------------------------------- ### Get Task Members via API Source: https://developer.clickup.com/docs/faq This endpoint retrieves a list of team members who have access to a specific task. It is part of the 'Members' section in the API documentation. ```HTTP GET /api/v2/task/{{task_id}}/member ``` -------------------------------- ### Filter Tasks by Status and Tag Source: https://developer.clickup.com/docs/filter-views Example of filtering tasks where the status is 'product backlog' or 'product review', OR the task has the tag '#bug'. This demonstrates the use of 'EQ' and 'ANY' operators within a group combined with 'OR', and then combined with another filter using 'AND'. ```json { "filter_groups": [ [ { "field": "status", "op": "EQ", "values": [ "product backlog", "product review" ] }, { "field": "tag", "op": "ANY", "values": [ "#bug" ] } ], [ { "field": "dueDate", "op": "EQ", "values": [ { "op": "yesterday" } ] } ] ], "filter_group_ops": [ "OR", "AND" ] } ``` -------------------------------- ### Upload Task Attachment using ClickUp API Source: https://developer.clickup.com/docs/attachments This snippet demonstrates how to upload attachments to ClickUp tasks. It requires the 'multipart/form-data' Content-Type and uses the 'attachment[]' array for files. Optional query parameters like 'custom_task_ids' and 'team_id' can be included. ```HTTP POST /api/v2/task/{task_id}/attachment HTTP/1.1 Host: api.clickup.com Authorization: pk_xxxxxxxxxxxxxx Content-Type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW ------WebKitFormBoundary7MA4YWxkTrZu0gW Content-Disposition: form-data; name="attachment[0]"; filename="example.txt" Content-Type: text/plain This is the content of the file. ------WebKitFormBoundary7MA4YWxkTrZu0gW-- ``` -------------------------------- ### View Subtasks in API Responses Source: https://developer.clickup.com/docs/faq Subtasks can be included in the responses of 'Get Task', 'Get Tasks', and 'Get Filtered Team Tasks' endpoints by using the 'subtasks' query parameter. ```HTTP GET /api/v2/task/{{task_id}}?subtasks=true ``` ```HTTP GET /api/v2/tasks?subtasks=true ``` ```HTTP GET /api/v2/filtered_team_tasks?subtasks=true ``` -------------------------------- ### ClickUp Space Updated Webhook Payload Source: https://developer.clickup.com/docs/webhookspacepayloads This JSON payload is sent when an existing Space in ClickUp is updated. The example shows a payload for when a Space was renamed. ```JSON { "event": "spaceUpdated", "space_id": "54650507", "webhook_id": "7fa3ec74-69a8-4530-a251-8a13730bd204" } ``` -------------------------------- ### Create Subtask via API Source: https://developer.clickup.com/docs/faq To create a subtask, use the 'Create Task' endpoint and specify the 'parent' property in the request body to link it to its parent task. ```JSON { "parent": "{{parent_task_id}}" } ``` -------------------------------- ### Get List Comments Source: https://developer.clickup.com/docs/comments Retrieve existing comments associated with a specific List via the API. This endpoint is part of the ClickUp API's comment management functionality. ```HTTP GET /api/v2/list/{list_id}/comment ``` -------------------------------- ### Get Task Comments Source: https://developer.clickup.com/docs/comments Retrieve existing comments associated with a specific task via the API. This endpoint is part of the ClickUp API's comment management functionality. ```HTTP GET /api/v2/task/{task_id}/comment ``` -------------------------------- ### Get Chat View Comments Source: https://developer.clickup.com/docs/comments Retrieve existing comments associated with a specific Chat View via the API. This endpoint is part of the ClickUp API's comment management functionality. ```HTTP GET /api/v2/chat/{chat_id}/comment ``` -------------------------------- ### Set Manual Progress Custom Field Value Source: https://developer.clickup.com/docs/customfields Sets the current value for a manual progress custom field. The value represents the progress relative to the start and end points. ```JSON { "value": { "current": 20 } } ``` -------------------------------- ### Configure Labels Custom Field Source: https://developer.clickup.com/docs/customfields Sets up a Labels custom field, similar to Tags, with manual sorting and a list of options. Each option includes an ID, label, color, and a unique order index. ```JSON { "name": "My Label Field", "type": "labels", "type_config": { "sorting": "manual" "options": [ { "id": "option_1_id", "label": "Label 1", "color": "#123456", "orderindex": "0" }, { "id": "option_2_id", "label": "Label 2", "color": "#FFFFFF", "orderindex": "1" } ] } } ``` -------------------------------- ### ClickUp API: Create Chat Channel by Location Source: https://developer.clickup.com/docs/chat Facilitates the creation of a chat channel associated with a specific location, such as a Space, Folder, or List. ```HTTP POST /api/v2/chat/channel/{location_type}/{location_id} ``` -------------------------------- ### Configure Currency Custom Field Source: https://developer.clickup.com/docs/customfields Sets up a Currency custom field, specifying the precision and currency type (e.g., USD). A default value can also be provided. ```JSON { "name": "My Currency Field", "type": "currency", "type_config": { "precision": 2, "currency_type": "USD", "default": 10 } } ``` -------------------------------- ### ClickUp API: Create Chat Channel Source: https://developer.clickup.com/docs/chat Allows for the creation of new chat channels via the ClickUp API. This is a core function for organizing conversations. ```HTTP POST /api/v2/chat/channel ``` -------------------------------- ### Create Task Comment Source: https://developer.clickup.com/docs/comments Create a new comment for a specific task via the API. This endpoint allows adding comments to tasks, including their content and associated details. ```HTTP POST /api/v2/task/{task_id}/comment ``` -------------------------------- ### Create List Comment Source: https://developer.clickup.com/docs/comments Create a new comment for a specific List via the API. This endpoint allows adding comments to lists, including their content and associated details. ```HTTP POST /api/v2/list/{list_id}/comment ``` -------------------------------- ### ClickUp API: Create Chat Message Reaction Source: https://developer.clickup.com/docs/chat Allows users to add reactions (e.g., emojis) to chat messages. ```HTTP POST /api/v2/chat/message/{message_id}/reaction ``` -------------------------------- ### ClickUp API: Create Reply Message Source: https://developer.clickup.com/docs/chat Allows for creating reply messages to an existing message, creating threaded conversations. ```HTTP POST /api/v2/chat/message/{message_id}/reply ``` -------------------------------- ### ClickUp API: Retrieve Chat Channels Source: https://developer.clickup.com/docs/chat Enables retrieval of existing chat channels. This is useful for listing or accessing channel information. ```HTTP GET /api/v2/chat/channel ``` -------------------------------- ### ClickUp API Authorization Header Missing Error (OAUTH_017) Source: https://developer.clickup.com/docs/common_errors This error indicates that the `Authorization` header was missing in the request. Ensure your requests include the necessary authorization token. ```http OAUTH_017 ``` -------------------------------- ### Access ClickUp API OpenAPI Specification Source: https://developer.clickup.com/docs/open-api-spec This snippet provides the URL to access the raw OpenAPI specification for the ClickUp API. This specification can be used with various API tools and code generators that support the OpenAPI format. ```URL https://developer.clickup.com/openapi/673cf4cfdca96a0019533cad ``` -------------------------------- ### Add Plain Text Comment Source: https://developer.clickup.com/docs/comment-formatting Demonstrates how to add a simple plain text comment using the ClickUp API. This is the most basic form of comment creation. ```JSON { "comment": [ { "text": "plain text", "attributes": {} } ] } ``` -------------------------------- ### Filter Tasks by Date Range (Array) - ClickUp API Source: https://developer.clickup.com/docs/range This example shows how to filter tasks using a date custom field by specifying the range as an array of low and high Unix timestamps. This is useful for querying tasks within a specific date period. ```JSON https://api.clickup.com/api/v2/team/{team_Id}/task?custom_fields=[ { "field_id": "ebea8db0-82f8-4d94-b09c-79992f17a8bb", "operator": "RANGE", "value": [1671246000000, 1671505200000] } ] ``` -------------------------------- ### Filter Tasks by Date Range (Object) - ClickUp API Source: https://developer.clickup.com/docs/range This example demonstrates filtering tasks by a date custom field using the 'RANGE' operator, defining the range with explicit 'low_value' and 'high_value' objects. This method provides clarity when specifying date boundaries in API requests. ```JSON https://api.clickup.com/api/v2/team/{team_Id}/task?custom_fields=[ { "field_id": "ebea8db0-82f8-4d94-b09c-79992f17a8bb", "operator": "RANGE", "value": { "low_value": 1671246000000, "high_value": 1671505200000 } } ] ``` -------------------------------- ### Search Tasks by Name and Description Source: https://developer.clickup.com/docs/filter-views Filters tasks by name, description, and Custom Field text using basic string matching. This filter is applied logically as (all filters) AND search. ```JSON { "filters": { "op": "AND", "fields": [], "search": "zebra", "show_closed": false } } ``` -------------------------------- ### Create Chat View Comment Source: https://developer.clickup.com/docs/comments Create a new comment for a specific Chat View via the API. This endpoint allows adding comments to chat views, including their content and associated details. ```HTTP POST /api/v2/chat/{chat_id}/comment ``` -------------------------------- ### ClickUp API: Create Direct Message Source: https://developer.clickup.com/docs/chat Allows for the creation of new direct messages between users via the API. ```HTTP POST /api/v2/chat/channel/dm ``` -------------------------------- ### ClickUp API: Create Chat Message Source: https://developer.clickup.com/docs/chat Enables the creation of new messages within a chat channel. ```HTTP POST /api/v2/chat/message/{channel_id} ``` -------------------------------- ### Format Task Descriptions with Escaped Quotes Source: https://developer.clickup.com/docs/tasks Demonstrates how to format task descriptions with escaped double quotation marks. This ensures that quotes within the text are displayed correctly. ```JSON "description": "Here is some text. \"This is speech.\" Additional text." ``` -------------------------------- ### Configure Dropdown Custom Field Source: https://developer.clickup.com/docs/customfields Defines a Dropdown custom field with manual sorting, a placeholder, and a default option. It includes an array of options, each with an ID, name, color, and order index. ```JSON { "name": "My Dropdown Field", "type": "drop_down", "type_config": { "sorting": "manual", "default": 0, "placeholder": "Select a value", "options": [ { "id": "option_1_id", "name": "Option 1", "color": "#FFFFF", "orderindex": "0" }, { "id": "option_2_id", "name": "Option 2", "color": "#000000", "orderindex": "1" } ] } } ``` -------------------------------- ### Format Comment as Code Block Source: https://developer.clickup.com/docs/comment-formatting Demonstrates how to create a code block within a comment using the ClickUp API. This involves using the 'code-block' attribute. ```JSON { "comment": [ { "text": "code block", "attributes": {} }, { "text": "\n", "attributes": { "code-block": { "code-block": "plain" } } } ] } ``` -------------------------------- ### Format Comment as Numbered List Source: https://developer.clickup.com/docs/comment-formatting Illustrates how to create an ordered (numbered) list in a comment using the ClickUp API. The 'list' attribute with value 'ordered' is used. ```JSON { "comment": [ { "text": "numbered list", "attributes": {} }, { "text":"\n", "attributes": { "list": { "list": "ordered" } } } ] } ``` -------------------------------- ### ClickUp API: Update Chat Channel Source: https://developer.clickup.com/docs/chat Allows for updating existing chat channels. This can include changing channel settings or metadata. ```HTTP PATCH /api/v2/chat/channel/{channel_id} ``` -------------------------------- ### Format Comment as Bulleted List Source: https://developer.clickup.com/docs/comment-formatting Shows how to create an unordered (bulleted) list in a comment using the ClickUp API. The 'list' attribute with value 'bullet' is used. ```JSON { "comment": [ { "text": "bulleted list", "attributes": {} }, { "text":"\n", "attributes": { "list": { "list": "bullet" } } } ] } ``` -------------------------------- ### ClickUp API Webhook Configuration Exists Error (OAUTH_171) Source: https://developer.clickup.com/docs/common_errors If a webhook with the same configuration and location already exists, you will receive the `OAUTH_171` error. This prevents duplicate webhook creations. ```http OAUTH_171 ```