### Authentication Setup Source: https://context7.com/teamwork/teamwork.com-api-request-examples/llms.txt Demonstrates how to set up headers for Basic Authentication using email/API key and password for Teamwork.com API requests. ```APIDOC ## Authentication Setup All API requests require Basic Authentication using your email address (or API key) and password. This authentication pattern is consistent across all endpoints in the Teamwork.com API. ### Request Example ```javascript const myHeaders = new Headers(); const userName = "email address or API KEY here"; const password = "password"; const siteName = "yourSiteName"; myHeaders.append("Content-Type", "application/json"); myHeaders.append("Authorization", "Basic " + btoa(userName + ":" + password)); const requestOptions = { method: "GET", headers: myHeaders, redirect: "follow" }; ``` ``` -------------------------------- ### Setup Basic Authentication for Teamwork.com API Source: https://context7.com/teamwork/teamwork.com-api-request-examples/llms.txt Configures request headers with Basic Authentication credentials (email/API key and password) required for all Teamwork.com API requests. This setup is essential for authenticating any subsequent API calls. ```javascript const myHeaders = new Headers(); const userName = "email address or API KEY here"; const password = "password"; const siteName = "yourSiteName"; myHeaders.append("Content-Type", "application/json"); myHeaders.append("Authorization", "Basic " + btoa(userName + ":" + password)); const requestOptions = { method: "GET", headers: myHeaders, redirect: "follow" }; ``` -------------------------------- ### Get All Tasks with Pagination Source: https://context7.com/teamwork/teamwork.com-api-request-examples/llms.txt Retrieves all tasks using the V3 endpoint with pagination support. Includes options for completed tasks, archived projects, and displays rate limit information from response headers. ```APIDOC ## GET /projects/api/v3/tasks.json ### Description Retrieves all tasks using the V3 endpoint with pagination support. Includes options for completed tasks, archived projects, and displays rate limit information from response headers. ### Method GET ### Endpoint `https://{siteName}.teamwork.com/projects/api/v3/tasks.json` ### Query Parameters - **showCompletedLists** (boolean) - Optional - Whether to show completed lists. - **includeCompletedTasks** (boolean) - Optional - Whether to include completed tasks. - **includeArchivedProjects** (boolean) - Optional - Whether to include archived projects. - **page** (integer) - Optional - The page number to retrieve. - **pageSize** (integer) - Optional - The number of tasks per page (max 500). ### Response #### Success Response (200) - **meta** (object) - Metadata about the response. - **page** (object) - Information about the current page. - **hasMore** (boolean) - Indicates if there are more pages. - **tasks** (array) - An array of task objects. #### Response Example ```json { "meta": { "page": { "number": 1, "size": 500, "hasMore": true } }, "tasks": [ { "id": 123, "name": "Example Task", "description": "This is an example task.", "status": "open", "createdAt": "2024-01-01T10:00:00Z", "updatedAt": "2024-01-01T10:00:00Z" } ] } ``` ### Rate Limit Information Response headers include `x-ratelimit-remaining` indicating the number of requests left in the current rate limit window. ``` -------------------------------- ### Get All Tasks with Pagination - JavaScript Source: https://context7.com/teamwork/teamwork.com-api-request-examples/llms.txt Retrieves all tasks using the v3 API endpoint with pagination support. This function handles fetching tasks page by page until all are retrieved. It includes options to show completed lists and tasks, include archived projects, and displays rate limit information from the response headers. ```javascript const myHeaders = new Headers(); const userName = "email address or API KEY here"; const password = "password"; const siteName = "yourSiteName"; let hasMore = true; let page = 1; myHeaders.append("Authorization", "Basic " + btoa(userName + ":" + password)); const requestOptions = { method: "GET", headers: myHeaders, redirect: "follow" }; async function fetchTasks() { do { let url = `https://${siteName}.teamwork.com/projects/api/v3/tasks.json?showCompletedLists=true&includeCompletedTasks=true&includeArchivedProjects=true&page=${page}&pageSize=500`; const response = await fetch(url, requestOptions); let data = await response.json(); console.log(data); // Check rate limits console.log("Rate limit remaining: " + response.headers.get('x-ratelimit-remaining')); hasMore = data.meta.page.hasMore; page++; } while (hasMore); } fetchTasks(); ``` -------------------------------- ### GET /projects/api/v2/time.json Source: https://context7.com/teamwork/teamwork.com-api-request-examples/llms.txt Retrieves a paginated list of time entries with various filtering options including project status and billable types. ```APIDOC ## GET /projects/api/v2/time.json ### Description Retrieves all time entries with pagination using the V2 endpoint. Includes filtering options for archived projects, billable/invoiced status, and displays time-related response headers. ### Method GET ### Endpoint https://{siteName}.teamwork.com/projects/api/v2/time.json ### Parameters #### Query Parameters - **page** (integer) - Optional - The page number to retrieve. - **pageSize** (integer) - Optional - Number of records per page. - **getTotals** (boolean) - Optional - Whether to include total time summaries in headers. ### Response #### Success Response (200) - **time-entries** (array) - List of time entry objects. - **x-pages** (header) - Total number of pages. - **x-total-mins-sum** (header) - Total minutes across all entries. ``` -------------------------------- ### Get Latest Activity Feed with Pagination Source: https://context7.com/teamwork/teamwork.com-api-request-examples/llms.txt Retrieves the latest activity feed from the Teamwork.com site, supporting filtering by date and project, along with pagination. This function iteratively fetches data until no more pages are available, logging each page of results. ```javascript // Endpoint: https://${siteName}/projects/api/v3/latestactivity.json const myHeaders = new Headers(); const userName = "email address or API KEY here"; const password = "password"; const siteName = "yourSiteName"; let loop = true; let page = 1; myHeaders.append("Authorization", "Basic " + btoa(userName + ":" + password)); const requestOptions = { method: "GET", headers: myHeaders, redirect: "follow" }; async function fetchActivity() { do { let url = `https://${siteName}.teamwork.com/projects/api/v3/latestactivity.json?skipCounts=true&range=allTime&include=users,projects,companies,tasks,reactions,notebooks,links&onlyStarredProjects=false&pageSize=50&page=${page}`; const response = await fetch(url, requestOptions); let data = await response.json(); console.log(data); if (page === 1) { loop = true; } else { loop = data.meta.page.hasMore; } page++; } while (loop); } fetchActivity(); ``` -------------------------------- ### POST /projects/{id}/tasklists.json Source: https://context7.com/teamwork/teamwork.com-api-request-examples/llms.txt Creates an empty tasklist within a specific project with default settings. ```APIDOC ## POST /projects/{id}/tasklists.json ### Description Creates an empty tasklist in a project with default task settings, optional icon, milestone association, and privacy controls. ### Method POST ### Endpoint https://{siteName}.teamwork.com/projects/{projectId}/tasklists.json ### Parameters #### Path Parameters - **projectId** (integer) - Required - The ID of the project to add the tasklist to. ### Request Body - **todo-list** (object) - Required - Tasklist configuration including name, description, and default task settings. ### Request Example { "todo-list": { "name": "Sprint 92", "description": "Sprint tasklist", "icon": "🏃" } } ### Response #### Success Response (200) - **todo-list-id** (integer) - The ID of the newly created tasklist ``` -------------------------------- ### POST /people.json Source: https://context7.com/teamwork/teamwork.com-api-request-examples/llms.txt Invite a new client user to the site with specific project access and permissions. ```APIDOC ## POST /people.json ### Description Invites a client user to the site with specific project access, permissions, and notification preferences. ### Method POST ### Endpoint https://{siteName}.teamwork.com/people.json ### Request Body - **person** (object) - Required - User details including email, name, and access settings. - **assignDefaultProjects** (boolean) - Optional - Whether to assign default projects. ### Request Example { "person": { "email-address": "client@example.com", "first-name": "John", "last-name": "Doe", "company-id": 12345, "isClientUser": true } } ### Response #### Success Response (200) - **status** (string) - Success message - **id** (integer) - The ID of the created user ``` -------------------------------- ### Create a Webhook Source: https://context7.com/teamwork/teamwork.com-api-request-examples/llms.txt Creates a webhook on a project to receive real-time notifications for events like task creation, updates, or comments. ```APIDOC ## POST /projects/{projectId}/webhooks.json ### Description Creates a webhook on a project to receive real-time notifications for events like task creation, updates, or comments. ### Method POST ### Endpoint https://{siteName}.teamwork.com/projects/{projectId}/webhooks.json ### Parameters #### Path Parameters - **projectId** (integer) - Required - The ID of the project to create the webhook on. #### Query Parameters None #### Request Body - **webhook** (object) - Required - Contains the webhook configuration. - **event** (string) - Required - The event to trigger the webhook (e.g., "TASK.CREATED"). - **url** (string) - Required - The URL to send the webhook notification to. - **version** (string) - Optional - The API version to use (defaults to "2"). - **contentType** (string) - Optional - The content type of the webhook payload (defaults to "application/json"). - **token** (string) - Optional - An API token for webhook verification. ### Request Example ```json { "webhook": { "event": "TASK.CREATED", "url": "https://your-webhook-endpoint.com/handler", "version": "2", "contentType": "application/json", "token": "your-api-token-for-checksum" } } ``` ### Response #### Success Response (200) - **webhook** (object) - Details of the created webhook. #### Response Example ```json { "webhook": { "id": "12345", "event": "TASK.CREATED", "url": "https://your-webhook-endpoint.com/handler", "version": "2", "contentType": "application/json", "token": "your-api-token-for-checksum", "created": "2023-10-27T10:00:00Z", "updated": "2023-10-27T10:00:00Z" } } ``` ``` -------------------------------- ### POST /projects/api/v3/projects/budgets.json Source: https://context7.com/teamwork/teamwork.com-api-request-examples/llms.txt Creates a project budget for financial or time-based tracking. ```APIDOC ## POST /projects/api/v3/projects/budgets.json ### Description Creates a project budget with financial or time-based tracking, notification thresholds, and project-specific rates. ### Method POST ### Endpoint https://{siteName}.teamwork.com/projects/api/v3/projects/budgets.json ### Request Body - **budget** (object) - Required - Budget configuration including capacity, dates, and notification settings. ### Request Example { "budget": { "budgetCategory": "STANDARD", "capacity": 10000, "type": "FINANCIAL", "projectId": 12345 } } ### Response #### Success Response (200) - **id** (integer) - The ID of the created budget ``` -------------------------------- ### Create a Project using Teamwork.com API Source: https://context7.com/teamwork/teamwork.com-api-request-examples/llms.txt Demonstrates how to create a new project in Teamwork.com via the API. It includes options for assigning users, setting tags, company, custom fields, and billable settings. Requires authentication headers and a JSON payload. ```javascript // Endpoint: https://apidocs.teamwork.com/docs/teamwork/v1/projects/post-projects-json const myHeaders = new Headers(); const userName = "email address or API KEY here"; const password = "password"; const siteName = "yourSiteName"; const companyId = 12345; const categoryId = 678; const userIds = "111,222,333"; const projectOwnerId = 111; myHeaders.append("Content-Type", "application/json"); myHeaders.append("Authorization", "Basic " + btoa(userName + ":" + password)); const raw = JSON.stringify({ "project": { "description": "Project created via API", "companyId": companyId, "name": "New API Project", "tagIds": "126786,57502", "grant-access-to": "0", "private": false, "category-id": categoryId, "people": userIds, "projectOwnerId": projectOwnerId, "customFields": [ { "customFieldId": 2586, "type": "text-short", "value": "TR453627" }, { "customFieldId": 3860, "type": "dropdown", "value": "Paid" }, { "customFieldId": 6050, "value": "https://example.com", "urlTextToDisplay": "Project Link" } ], "isBillable": true, "projectType": "normal", "workflowId": 1499 } }); fetch("https://" + siteName + ".teamwork.com/projects.json", { method: "POST", headers: myHeaders, body: raw, redirect: "follow" }) .then((response) => response.text()) .then((result) => console.log(result)) .catch((error) => console.error(error)); ``` -------------------------------- ### Create Teamwork.com Notebook (JavaScript) Source: https://context7.com/teamwork/teamwork.com-api-request-examples/llms.txt Creates a markdown notebook within a specified project. It allows for optional category assignment, notification settings, and privacy controls. Requires project ID and notebook details. ```javascript const myHeaders = new Headers(); const userName = "email address or API KEY here"; const password = "password"; const siteName = "yourSiteName"; const projectId = 12345; const notebookCategoryId = 678; myHeaders.append("Content-Type", "application/json"); myHeaders.append("Authorization", "Basic " + btoa(userName + ":" + password)); const raw = JSON.stringify({ "notebook": { "name": "Project Documentation", "description": "", "content": "# Project Overview\n\nThis notebook contains important project documentation.\n\n## Getting Started\n\n...", "category-id": notebookCategoryId, "locked": false, "notebook-type": "MARKDOWN", "notify": "ALL", "notify-current-user": false, "secureContent": false, "grant-access-to": "", "private": 0 } }); fetch("https://" + siteName + ".teamwork.com/projects/" + projectId + "/notebooks.json", { method: "POST", headers: myHeaders, body: raw, redirect: "follow" }) .then((response) => response.text()) .then((result) => console.log(result)) .catch((error) => console.error(error)); ``` -------------------------------- ### POST /projects/{projectId}/notebooks.json Source: https://context7.com/teamwork/teamwork.com-api-request-examples/llms.txt Creates a markdown notebook within a specified project. Supports optional settings for categories, notifications, and privacy. ```APIDOC ## Create a Notebook Creates a markdown notebook in a project with optional category, notifications, and privacy settings. ### Method POST ### Endpoint `https://.teamwork.com/projects//notebooks.json` ### Request Body - **notebook** (object) - Required - Contains notebook details. - **name** (string) - Required - The name of the notebook. - **description** (string) - Optional - A description for the notebook. - **content** (string) - Required - The markdown content of the notebook. - **category-id** (integer) - Optional - The ID of the category to assign the notebook to. - **locked** (boolean) - Optional - Whether the notebook is locked. - **notebook-type** (string) - Optional - The type of notebook (e.g., "MARKDOWN"). - **notify** (string) - Optional - Notification setting (e.g., "ALL"). - **notify-current-user** (boolean) - Optional - Whether to notify the current user. - **secureContent** (boolean) - Optional - Whether the content is secure. - **grant-access-to** (string) - Optional - Specifies access grants. - **private** (integer) - Optional - Privacy setting (0 for public, 1 for private). ### Request Example ```json { "notebook": { "name": "Project Documentation", "description": "", "content": "# Project Overview\n\nThis notebook contains important project documentation.\n\n## Getting Started\n\n...", "category-id": 678, "locked": false, "notebook-type": "MARKDOWN", "notify": "ALL", "notify-current-user": false, "secureContent": false, "grant-access-to": "", "private": 0 } } ``` ### Response #### Success Response (200) - **notebook** (object) - Details of the created notebook. #### Response Example ```json { "notebook": { "id": 123, "name": "Project Documentation", "description": "", "content": "# Project Overview\n\nThis notebook contains important project documentation.\n\n## Getting Started\n\n...", "category-id": 678, "locked": false, "notebook-type": "MARKDOWN", "notify": "ALL", "notify-current-user": false, "secureContent": false, "grant-access-to": "", "private": 0, "created-at": "2023-10-27T10:00:00Z", "updated-at": "2023-10-27T10:00:00Z" } } ``` ``` -------------------------------- ### Create a Client Company (V3 API) Source: https://context7.com/teamwork/teamwork.com-api-request-examples/llms.txt Registers a new client company in Teamwork. Includes fields for contact information, website, and internal notes. ```javascript const myHeaders = new Headers(); const userName = "email address or API KEY here"; const password = "password"; const siteName = "yourSiteName"; myHeaders.append("Content-Type", "application/json"); myHeaders.append("Authorization", "Basic " + btoa(userName + ":" + password)); const raw = JSON.stringify({ "company": { "name": "New Client Company", "website": "https://www.example.com", "emailOne": "contact@example.com", "phone": "1234567890", "addressOne": "123 Main Street", "addressTwo": "Suite 100", "city": "New York", "state": "NY", "zip": "10001", "privateNotes": "Internal notes about the client", "profile": "Public company profile information", "logoPendingFileRef": "tf_6444e389-a673-47a9-a165-959bd5926f64.png" } }); fetch(`https://${siteName}.teamwork.com/projects/api/v3/companies.json`, { method: "POST", headers: myHeaders, body: raw, redirect: "follow" }) .then((response) => response.text()) .then((result) => console.log(result)) .catch((error) => console.error(error)); ``` -------------------------------- ### Create Project Budget in Teamwork Source: https://context7.com/teamwork/teamwork.com-api-request-examples/llms.txt This snippet illustrates how to create a project budget, supporting financial or time-based tracking. It includes options for notification thresholds and project-specific rates. Requires 'projectId' and 'userId' for notifications. The 'type' can be 'FINANCIAL' or 'TIME'. ```javascript const myHeaders = new Headers(); const userName = "email address or API KEY here"; const password = "password"; const siteName = "yourSiteName"; const projectId = 12345; const userId = 67890; myHeaders.append("Content-Type", "application/json"); myHeaders.append("Authorization", "Basic " + btoa(userName + ":" + password)); const raw = JSON.stringify({ "budget": { "budgetCategory": "STANDARD", "capacity": 10000, "endDateTime": "20241231", "isRepeating": false, "notifications": [ { "notificationMedium": "EMAIL", "capacityThreshold": 80, "userIds": [userId], "teamIds": [], "companyIds": [] } ], "projectId": projectId, "startDateTime": "20240101", "type": "FINANCIAL", "timelogType": "BILLABLE", "isRetainer": false, "projectRate": 15000 } }); fetch("https://" + siteName + ".teamwork.com/projects/api/v3/projects/budgets.json", { method: "POST", headers: myHeaders, body: raw, redirect: "follow" }) .then((response) => response.text()) .then((result) => console.log(result)) .catch((error) => console.error(error)); ``` -------------------------------- ### POST /projects/api/v3/workflows.json Source: https://context7.com/teamwork/teamwork.com-api-request-examples/llms.txt Creates a new workflow for a project, suitable for task management and organizing tasks on a kanban board. ```APIDOC ## Create a Workflow Creates a project-specific workflow for task management and kanban board organization. ### Method POST ### Endpoint `https://.teamwork.com/projects/api/v3/workflows.json` ### Request Body - **workflow** (object) - Required - Contains workflow details. - **name** (string) - Required - The name of the workflow. - **projectId** (integer) - Required - The ID of the project this workflow belongs to. - **projectSpecific** (boolean) - Required - Indicates if the workflow is specific to a project. ### Request Example ```json { "workflow": { "name": "Development Pipeline", "projectId": 12345, "projectSpecific": true } } ``` ### Response #### Success Response (200) - **workflow** (object) - Details of the created workflow. #### Response Example ```json { "workflow": { "id": 101, "name": "Development Pipeline", "projectId": 12345, "projectSpecific": true, "order": 0, "createdAt": "2023-10-27T10:05:00Z", "updatedAt": "2023-10-27T10:05:00Z" } } ``` ``` -------------------------------- ### Create Teamwork.com Workflow (JavaScript) Source: https://context7.com/teamwork/teamwork.com-api-request-examples/llms.txt Creates a new workflow for a project, which is essential for task management and organizing tasks on a kanban board. Requires project ID and workflow name. ```javascript const myHeaders = new Headers(); const userName = "email address or API KEY here"; const password = "password"; const siteName = "yourSiteName"; const projectId = 12345; myHeaders.append("Content-Type", "application/json"); myHeaders.append("Authorization", "Basic " + btoa(userName + ":" + password)); const raw = JSON.stringify({ "workflow": { "name": "Development Pipeline", "projectId": projectId, "projectSpecific": true } }); fetch(`https://${siteName}.teamwork.com/projects/api/v3/workflows.json`, { method: "POST", headers: myHeaders, body: raw, redirect: "follow" }) .then((response) => response.text()) .then((result) => console.log(result)) .catch((error) => console.error(error)); ``` -------------------------------- ### Create a Time Entry (V1 Endpoint) Source: https://context7.com/teamwork/teamwork.com-api-request-examples/llms.txt Logs time against a specific task with person assignment, billable status, and optional tags. Time is specified in hours and minutes with a date and time reference. ```APIDOC ## POST /tasks/{taskId}/time_entries.json ### Description Logs time against a specific task with person assignment, billable status, and optional tags. Time is specified in hours and minutes with a date and time reference. ### Method POST ### Endpoint `https://{siteName}.teamwork.com/tasks/{taskId}/time_entries.json` ### Parameters #### Path Parameters - **taskId** (integer) - Required - The ID of the task to log time against. #### Request Body - **time-entry** (object) - Required - Contains the details of the time entry. - **description** (string) - Required - A description of the time entry. - **date** (string) - Required - The date of the time entry (YYYYMMDD). - **person-id** (integer) - Required - The ID of the person logging the time. - **time** (string) - Optional - The time of the entry (HH:MM). - **hours** (integer) - Optional - The number of hours logged. - **minutes** (integer) - Optional - The number of minutes logged. - **isbillable** (boolean) - Optional - Whether the time entry is billable. - **tags** (string) - Optional - Tags associated with the time entry. ### Request Example ```json { "time-entry": { "description": "Time created via API", "date": "20230801", "person-id": 256492, "time": "15:00", "hours": 4, "minutes": 35, "isbillable": true, "tags": "API" } } ``` ### Response #### Success Response (200) - **time-entry** (object) - Details of the created time entry. #### Response Example ```json { "time-entry": { "id": 123456, "description": "Time created via API", "date": "20230801", "personId": 256492, "time": "15:00", "hours": 4, "minutes": 35, "isBillable": true, "tags": "API", "createdAt": "2023-08-01T15:00:00Z" } } ``` ``` -------------------------------- ### Create a Message Source: https://context7.com/teamwork/teamwork.com-api-request-examples/llms.txt Posts a message to a project with rich text content, user mentions, notifications, and category assignment. ```APIDOC ## POST /projects/{projectId}/messages.json ### Description Posts a message to a project with rich text content, user mentions, notifications, and category assignment. ### Method POST ### Endpoint https://{siteName}.teamwork.com/projects/{projectId}/messages.json ### Parameters #### Path Parameters - **projectId** (integer) - Required - The ID of the project to post the message to. #### Query Parameters None #### Request Body - **post** (object) - Required - Contains the message details. - **category-id** (integer) - Required - The ID of the category to post the message to. - **title** (string) - Required - The title of the message. - **body** (string) - Required - The content of the message. - **content-type** (string) - Optional - The content type of the message (e.g., "TEXT"). - **notify** (integer) - Optional - The ID of the user to notify. - **notify-current-user** (boolean) - Optional - Whether to notify the current user. - **tagIds** (string) - Optional - Comma-separated list of tag IDs to associate with the message. - **grant-access-to** (string) - Optional - Comma-separated list of user IDs to grant access to. - **private** (integer) - Optional - Whether the message is private (0 for public, 1 for private). - **pendingFileAttachments** (array) - Optional - Array of pending file attachments. - **updateFiles** (boolean) - Optional - Whether to update files. ### Request Example ```json { "post": { "category-id": 678, "title": "Project Update", "body": "Hey @john, here is the latest update on our project progress.\n\nWe have completed the following items:\n- Task 1\n- Task 2\n\nPlease review and let me know your thoughts.", "content-type": "TEXT", "notify": 11111, "notify-current-user": true, "tagIds": "123,456", "grant-access-to": "", "private": 0, "pendingFileAttachments": [], "updateFiles": true } } ``` ### Response #### Success Response (200) - **post** (object) - Details of the created message. #### Response Example ```json { "post": { "id": "98765", "title": "Project Update", "body": "Hey @john, here is the latest update on our project progress.\n\nWe have completed the following items:\n- Task 1\n- Task 2\n\nPlease review and let me know your thoughts.", "author": { "id": "11111", "name": "Jane Doe" }, "created": "2023-10-27T10:00:00Z" } } ``` ``` -------------------------------- ### Create a Task using Teamwork.com API (V3) Source: https://context7.com/teamwork/teamwork.com-api-request-examples/llms.txt Shows how to create a task within a specific tasklist using the Teamwork.com API v3. This includes assigning users, setting priority, due dates, descriptions, and optionally placing the task on a kanban board column. Requires authentication and a structured JSON payload. ```javascript // Endpoint: https://apidocs.teamwork.com/docs/teamwork/v3/tasks/post-projects-api-v3-tasklists-tasklist-id-tasks-json const myHeaders = new Headers(); const userName = "email address or API KEY here"; const password = "password"; const siteName = "yourSiteName"; const taskListId = 54321; const userId = 12345; const columnId = 98765; myHeaders.append("Content-Type", "application/json"); myHeaders.append("Authorization", "Basic " + btoa(userName + ":" + password)); const raw = JSON.stringify({ "task": { "tasklistId": taskListId, "name": "New task from API", "assignees": { "userIds": [userId] }, "priority": "medium", "startAt": "2024-04-16", "dueAt": "2024-04-24", "description": "Task description with [markdown](https://example.com) support" }, "taskOptions": { "notify": true }, "card": { "columnId": columnId } }); fetch("https://" + siteName + ".teamwork.com/projects/api/v3/tasklists/" + taskListId + "/tasks.json", { method: "POST", headers: myHeaders, body: raw, redirect: "follow" }) .then((response) => response.text()) .then((result) => console.log(result)) .catch((error) => console.error(error)); ``` -------------------------------- ### POST /projects/api/v3/companies.json Source: https://context7.com/teamwork/teamwork.com-api-request-examples/llms.txt Creates a new client company profile with contact information and optional branding assets. ```APIDOC ## POST /projects/api/v3/companies.json ### Description Creates a new client/company with full contact information, notes, and optional logo. Supports multi-currency settings. ### Method POST ### Endpoint https://{siteName}.teamwork.com/projects/api/v3/companies.json ### Request Body - **company** (object) - Required - Contains name, website, emailOne, phone, addressOne, addressTwo, city, state, zip, privateNotes, profile, and logoPendingFileRef. ### Request Example { "company": { "name": "New Client Company", "website": "https://www.example.com", "emailOne": "contact@example.com" } } ### Response #### Success Response (200) - **id** (integer) - The ID of the newly created company. ``` -------------------------------- ### Create Tasklist in Teamwork Project Source: https://context7.com/teamwork/teamwork.com-api-request-examples/llms.txt This snippet shows how to create an empty tasklist within a specific project. It allows for default task settings, an optional icon, milestone association, and privacy controls. Key parameters include 'name', 'description', and 'private' status. Requires 'projectId'. ```javascript const myHeaders = new Headers(); const userName = "email address or API KEY here"; const password = "password"; const siteName = "yourSiteName"; const projectId = 12345; myHeaders.append("Content-Type", "application/json"); myHeaders.append("Authorization", "Basic " + btoa(userName + ":" + password)); const raw = JSON.stringify({ "applyDefaultsToExistingTasks": false, "todo-list": { "private": false, "isBillable": null, "description": "Sprint tasklist", "milestone-id": 0, "icon": "🏃", "name": "Sprint 92 - 1/21-2/3", "grant-access-to": "", "new-task-defaults": { "change-follower-ids": "", "comment-follower-ids": "", "description": "", "due-date-offset": "", "estimated-minutes": 0, "grant-access-to": "0", "private": false, "responsible-party-id": "", "start-date-offset": "", "tagIds": "", "priority": null, "customFields": [] } } }); fetch(`https://${siteName}.teamwork.com/projects/${projectId}/tasklists.json`, { method: "POST", headers: myHeaders, body: raw, redirect: "follow" }) .then((response) => response.text()) .then((result) => console.log(result)) .catch((error) => console.error(error)); ``` -------------------------------- ### Create a Time Entry (V3 API) Source: https://context7.com/teamwork/teamwork.com-api-request-examples/llms.txt Creates a new time entry associated with a specific task and project. It supports UTC time, billable status, and the simultaneous creation of new tags. ```javascript const myHeaders = new Headers(); const userName = "email address or API KEY here"; const password = "password"; const siteName = "yourSiteName"; const taskId = 12345; const projectId = 67890; const userId = 11111; myHeaders.append("Content-Type", "application/json"); myHeaders.append("Authorization", "Basic " + btoa(userName + ":" + password)); const raw = JSON.stringify({ "timelog": { "date": "2024-01-23", "time": "17:18:00", "isUtc": true, "description": "Meeting with Marketing", "isBillable": true, "minutes": 35, "projectId": projectId, "taskId": taskId, "userId": userId, "tagIds": [132176] }, "tags": [ { "color": "#f78233", "name": "Meeting", "projectId": 0 } ], "timelogOptions": { "markTaskComplete": false } }); fetch(`https://${siteName}.teamwork.com/projects/api/v3/tasks/${taskId}/time.json`, { method: "POST", headers: myHeaders, body: raw, redirect: "follow" }) .then((response) => response.text()) .then((result) => console.log(result)) .catch((error) => console.error(error)); ``` -------------------------------- ### POST /projects/api/v3/tasklists/{taskListId}/tasks.json Source: https://context7.com/teamwork/teamwork.com-api-request-examples/llms.txt Creates a new task within a specified task list, supporting assignees, priorities, dates, descriptions, and Kanban board placement. ```APIDOC ## POST /projects/api/v3/tasklists/{taskListId}/tasks.json Creates a task in a tasklist with assignees, priority, dates, description, and optional workflow column placement. Supports notification settings and can place tasks directly on kanban board columns. ### Method POST ### Endpoint `https://{siteName}/projects/api/v3/tasklists/{taskListId}/tasks.json` ### Parameters #### Path Parameters - **taskListId** (integer) - Required - The ID of the task list where the task will be created. #### Request Body - **task** (object) - Required - The task details. - **tasklistId** (integer) - Required - The ID of the task list. - **name** (string) - Required - The name of the task. - **assignees** (object) - Optional - Assignees for the task. - **userIds** (array) - Required - An array of user IDs to assign the task to. - **priority** (string) - Optional - The priority of the task (e.g., "medium", "high"). - **startAt** (string) - Optional - The start date of the task (YYYY-MM-DD). - **dueAt** (string) - Optional - The due date of the task (YYYY-MM-DD). - **description** (string) - Optional - The description of the task, supports markdown. - **taskOptions** (object) - Optional - Options for the task. - **notify** (boolean) - Optional - Whether to notify assignees. - **card** (object) - Optional - Kanban card details. - **columnId** (integer) - Required - The ID of the Kanban column to place the task in. ### Request Example ```json { "task": { "tasklistId": 54321, "name": "New task from API", "assignees": { "userIds": [12345] }, "priority": "medium", "startAt": "2024-04-16", "dueAt": "2024-04-24", "description": "Task description with [markdown](https://example.com) support" }, "taskOptions": { "notify": true }, "card": { "columnId": 98765 } } ``` ### Response #### Success Response (200) - **task** (object) - Details of the created task. #### Response Example ```json { "task": { "id": 987654, "tasklistId": 54321, "name": "New task from API", "description": "Task description with [markdown](https://example.com) support", "creatorId": 111, "assignees": [ { "id": 12345, "loginname": "assignee@example.com", "firstName": "Assignee", "lastName": "User" } ] // ... other task details } } ``` ``` -------------------------------- ### POST /projects.json Source: https://context7.com/teamwork/teamwork.com-api-request-examples/llms.txt Creates a new project in Teamwork.com, allowing configuration of users, tags, company, custom fields, and workflow settings. ```APIDOC ## POST /projects.json Creates a new project with users, tags, company assignment, custom fields, and optional workflow configuration. The project can include billable settings, categories, and custom field values of various types (text, dropdown, URL). ### Method POST ### Endpoint `https://{siteName}.teamwork.com/projects.json` ### Parameters #### Request Body - **project** (object) - Required - Project details. - **description** (string) - Optional - Project description. - **companyId** (integer) - Required - The ID of the company the project belongs to. - **name** (string) - Required - The name of the project. - **tagIds** (string) - Optional - Comma-separated IDs of tags to associate with the project. - **grant-access-to** (string) - Optional - Controls access permissions. - **private** (boolean) - Optional - Whether the project is private. - **category-id** (integer) - Optional - The ID of the project category. - **people** (string) - Optional - Comma-separated IDs of users to grant access to. - **projectOwnerId** (integer) - Optional - The ID of the user who owns the project. - **customFields** (array) - Optional - An array of custom field objects. - **customFieldId** (integer) - Required - The ID of the custom field. - **type** (string) - Required - The type of the custom field (e.g., "text-short", "dropdown", "url"). - **value** (string/object) - Required - The value for the custom field. - **urlTextToDisplay** (string) - Optional - Text to display for URL type custom fields. - **isBillable** (boolean) - Optional - Whether the project is billable. - **projectType** (string) - Optional - The type of project (e.g., "normal"). - **workflowId** (integer) - Optional - The ID of the workflow to use. ### Request Example ```json { "project": { "description": "Project created via API", "companyId": 12345, "name": "New API Project", "tagIds": "126786,57502", "grant-access-to": "0", "private": false, "category-id": 678, "people": "111,222,333", "projectOwnerId": 111, "customFields": [ { "customFieldId": 2586, "type": "text-short", "value": "TR453627" }, { "customFieldId": 3860, "type": "dropdown", "value": "Paid" }, { "customFieldId": 6050, "value": "https://example.com", "urlTextToDisplay": "Project Link" } ], "isBillable": true, "projectType": "normal", "workflowId": 1499 } } ``` ### Response #### Success Response (200) - **project** (object) - Details of the created project. #### Response Example ```json { "project": { "id": 123456, "name": "New API Project", "description": "Project created via API", "company": { "id": 12345, "name": "Example Company" }, "owner": { "id": 111, "loginname": "user@example.com", "firstName": "User", "lastName": "Example" } // ... other project details } } ``` ``` -------------------------------- ### Create Time Entry (V1) - JavaScript Source: https://context7.com/teamwork/teamwork.com-api-request-examples/llms.txt Logs time against a specific task using the v1 API endpoint. This function allows specifying the description, date, person assigned, time, duration (hours and minutes), billable status, and tags. It requires the task ID and site name for the request. ```javascript const myHeaders = new Headers(); const userName = "email address or API KEY here"; const password = "password"; const siteName = "yourSiteName"; const taskId = 12345; myHeaders.append("Content-Type", "application/json"); myHeaders.append("Authorization", "Basic " + btoa(userName + ":" + password)); const raw = JSON.stringify({ "time-entry": { "description": "Time created via API", "date": "20230801", "person-id": 256492, "time": "15:00", "hours": 4, "minutes": 35, "isbillable": true, "tags": "API" } }); fetch("https://" + siteName + ".teamwork.com/tasks/" + taskId + "/time_entries.json", { method: "POST", headers: myHeaders, body: raw, redirect: "follow" }) .then((response) => response.text()) .then((result) => console.log(result)) .catch((error) => console.error(error)); ```