### Configure Webhooks in Marvin Source: https://context7.com/pakrentos/marvinapi-wiki/llms.txt This snippet illustrates how to configure webhooks in Marvin to receive real-time notifications. It includes an example configuration object, available trigger types, and an example payload. CORS configuration on the server is required. ```javascript // Webhook configuration object (stored in profile.strategySettings.webhooks) { "type": "markDoneTask", // Trigger type "smartListId": "label_urgent", // Optional filter "method": "POST", "url": "https://your-server.com/api/marvin-webhook", "headers": { "Authorization": "Bearer your-secret-token" } } // Available webhook types: // - "add", "addTask", "addProject" - Item creation // - "edit", "editTask", "editProject" - Item modification // - "markDone", "markDoneTask", "markDoneProject" - Completion // - "delete", "deleteTask", "deleteProject" - Deletion // - "startTracking", "stopTracking" - Time tracking // - "addTimer", "pauseTimer", "resumeTimer", "deleteTimer", "timerDone" - Timers // - "addHabit", "editHabit", "recordHabit", "deleteHabit" - Habits // Example webhook payload for markDoneTask: // POST https://your-server.com/api/marvin-webhook // { // "_id": "task_abc123", // "title": "Complete report", // "done": true, // "completedAt": 1678378323530, // "duration": 3600000, // "times": [1678374723530, 1678378323530] // } // Required CORS headers on your server: // Access-Control-Allow-Methods: OPTIONS, POST // Access-Control-Allow-Headers: Content-Type, Authorization // Access-Control-Allow-Origin: https://app.amazingmarvin.com ``` -------------------------------- ### GET /api/goals Source: https://context7.com/pakrentos/marvinapi-wiki/llms.txt Retrieve all goals with their sections, progress tracking, and metadata. ```APIDOC ## GET /api/goals ### Description Retrieve all goals with their sections, progress tracking, and metadata. ### Method GET ### Endpoint https://serv.amazingmarvin.com/api/goals ### Response #### Success Response (200) - **_id** (string) - The ID of the goal. - **title** (string) - The title of the goal. - **status** (string) - The status of the goal (e.g., "active"). - **dueDate** (string) - The due date of the goal in YYYY-MM-DD format. - **sections** (array of objects) - An array of goal sections. - **_id** (string) - The ID of the section. - **title** (string) - The title of the section. #### Response Example ```json [ { "_id": "goal1", "title": "Learn Spanish", "status": "active", "dueDate": "2024-12-31", "sections": [ { "_id": "sec1", "title": "Vocabulary" }, { "_id": "sec2", "title": "Grammar" } ] } ] ``` ``` -------------------------------- ### Start or Stop Time Tracking for a Task Source: https://github.com/pakrentos/marvinapi-wiki/blob/master/Marvin-API.md Initiates or terminates time tracking for a specific task using its ID. Requires a task ID and an action ('START' or 'STOP'). The API returns details about the tracking session, including start and stop times. Note: The user is responsible for updating the task's duration and times after stopping tracking. ```http POST /api/track POST /api/time # alias X-API-TOKEN: XYZ { taskId: "abc", action: "START" } => { startId: "abc", startTimes: [1595791080814], stopId: "xyz", // or null stopTimes: [1595791066096, 1595791080814], issues: ["Wanted to..."], } ``` -------------------------------- ### Create Event Source: https://context7.com/pakrentos/marvinapi-wiki/llms.txt Creates a calendar event with a title, start time, and duration. Requires Marvin to be running for calendar sync. ```bash curl -X POST \ -H "X-API-Token: YOUR_API_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "title": "Team standup meeting", "note": "Weekly sync with engineering team", "start": "2024-01-15T09:00:00.000Z", "length": 1800000 }' \ https://serv.amazingmarvin.com/api/addEvent ``` -------------------------------- ### Start/Stop Time Tracking Source: https://github.com/pakrentos/marvinapi-wiki/blob/master/Marvin-API.md Use the `/api/track` or `/api/time` endpoint to start or stop time tracking for a task by its ID. Requires an `X-API-TOKEN` header and a JSON body specifying the `taskId` and `action` ('START' or 'STOP'). ```APIDOC ## POST /api/track ### Description Starts or stops time tracking for a given task. ### Method POST ### Endpoint /api/track ### Headers - **X-API-TOKEN** (string) - Required - Your API token ### Request Body - **taskId** (string) - Required - The ID of the task to track - **action** (string) - Required - The action to perform, either 'START' or 'STOP' ### Request Example ```json { "taskId": "abc", "action": "START" } ``` ### Response #### Success Response (200) Returns an object with start and stop times for the task. - **startId** (string) - The ID of the started time entry. - **startTimes** (array) - An array of timestamps when tracking started. - **stopId** (string or null) - The ID of the stopped time entry, or null if not stopped. - **stopTimes** (array) - An array of timestamps when tracking stopped. - **issues** (array) - An array of any issues encountered during tracking. ### Response Example ```json { "startId": "abc", "startTimes": [1595791080814], "stopId": null, "stopTimes": [], "issues": [] } ``` ``` -------------------------------- ### Get All Reminders Source: https://github.com/pakrentos/marvinapi-wiki/blob/master/Marvin-API.md Retrieve a list of all scheduled reminders using the `GET /api/reminders` endpoint. Requires an `X-Full-Access-Token` header. ```APIDOC ## GET /api/reminders ### Description Retrieves a list of all currently scheduled reminders. ### Method GET ### Endpoint /api/reminders ### Headers - **X-Full-Access-Token** (string) - Required - Your full access token. ### Response #### Success Response (200) Returns an array of Reminder objects. ### Response Example ```json Reminder[] ``` ``` -------------------------------- ### List All Habits API Source: https://github.com/pakrentos/marvinapi-wiki/blob/master/Marvin-API.md Retrieves a list of all habits, with full history, via a GET request to the /api/habits endpoint. Requires an API token. Returns an array of habit objects. Use ?raw=1 with a full access token to get entire habit objects. ```HTTP GET /api/habits X-API-Token: XYZ => [...] ``` -------------------------------- ### GET /api/dueItems Source: https://context7.com/pakrentos/marvinapi-wiki/llms.txt Retrieve all open tasks and projects that are due on or before a specified date. ```APIDOC ## GET /api/dueItems ### Description Retrieve all open tasks and projects that are due on or before a specified date. ### Method GET ### Endpoint https://serv.amazingmarvin.com/api/dueItems ### Parameters #### Query Parameters - **by** (string) - Required - The date on or before which items are due (YYYY-MM-DD). ### Request Example ```bash curl -X GET \ -H "X-API-Token: YOUR_API_TOKEN" \ "https://serv.amazingmarvin.com/api/dueItems?by=2024-01-15" ``` ### Response #### Success Response (200) - **_id** (string) - The unique identifier of the item. - **title** (string) - The title of the item. - **dueDate** (string) - The due date of the item (YYYY-MM-DD). - **done** (boolean) - Indicates if the item is completed. #### Response Example ```json [ { "_id": "task1", "title": "Submit report", "dueDate": "2024-01-15", "done": false }, { "_id": "task2", "title": "Pay invoice", "dueDate": "2024-01-10", "done": false } ] ``` ``` -------------------------------- ### Get Goals Source: https://context7.com/pakrentos/marvinapi-wiki/llms.txt Retrieves all goals associated with the account, including their sections, progress tracking details, and metadata. Requires an API token. ```bash curl -X GET \ -H "X-API-Token: YOUR_API_TOKEN" \ https://serv.amazingmarvin.com/api/goals # Response: # [ # { # "_id": "goal1", # "title": "Learn Spanish", # "status": "active", # "dueDate": "2024-12-31", # "sections": [ # { "_id": "sec1", "title": "Vocabulary" }, # { "_id": "sec2", "title": "Grammar" } # ] # } # ] ``` -------------------------------- ### Create an Event API Source: https://context7.com/pakrentos/marvinapi-wiki/llms.txt Create a calendar event with title, start time, and duration. Note that calendar sync requires Marvin to be running on a device. ```APIDOC ## POST /api/addEvent ### Description Creates a new calendar event. ### Method POST ### Endpoint `/api/addEvent` ### Parameters #### Headers - **X-API-Token** (string) - Required - Your API token. - **Content-Type** (string) - Required - `application/json` #### Request Body - **title** (string) - Required - The title of the event. - **note** (string) - Optional - Description for the event. - **start** (string) - Required - The start time of the event in ISO 8601 format (e.g., "2024-01-15T09:00:00.000Z"). - **length** (integer) - Required - The duration of the event in milliseconds. ### Request Example ```json { "title": "Team standup meeting", "note": "Weekly sync with engineering team", "start": "2024-01-15T09:00:00.000Z", "length": 1800000 } ``` ### Response #### Success Response (200) - **itemId** (string) - The ID of the newly created event. - **message** (string) - Confirmation message. #### Response Example ```json { "itemId": "new_event_id_789", "message": "Event created successfully" } ``` ``` -------------------------------- ### GET /api/reminders Source: https://context7.com/pakrentos/marvinapi-wiki/llms.txt Retrieve all currently scheduled reminders. ```APIDOC ## GET /api/reminders ### Description Retrieve all currently scheduled reminders. ### Method GET ### Endpoint https://serv.amazingmarvin.com/api/reminders ### Response #### Success Response (200) - **time** (number) - The timestamp for the reminder. - **reminderId** (string) - The unique identifier for the reminder. - **type** (string) - The type of reminder. - **title** (string) - The title of the reminder. - **snooze** (number) - The snooze duration in minutes. #### Response Example ```json [ { "time": 1678098457, "reminderId": "reminder_uuid_12345", "type": "T", "title": "Team meeting", "snooze": 9 } ] ``` ``` -------------------------------- ### GET /api/habits Source: https://context7.com/pakrentos/marvinapi-wiki/llms.txt Retrieve all habits with their full recording history. ```APIDOC ## GET /api/habits ### Description Retrieve all habits with their full recording history. ### Method GET ### Endpoint https://serv.amazingmarvin.com/api/habits ### Query Parameters - **raw** (boolean) - Optional - If set to `1`, returns full habit objects (requires full access token). ### Response #### Success Response (200) - **_id** (string) - The ID of the habit. - **title** (string) - The title of the habit. - **period** (string) - The period of the habit (e.g., "day"). - **target** (number) - The target value for the habit. - **history** (array) - An array representing the habit's recording history. Each entry typically consists of a timestamp and a value. #### Response Example ```json [ { "_id": "habit1", "title": "Exercise", "period": "day", "target": 1, "history": [1646092800000, 1, 1646179200000, 1] } ] ``` ``` -------------------------------- ### GET /api/me Source: https://context7.com/pakrentos/marvinapi-wiki/llms.txt Retrieve profile information about the authenticated account. ```APIDOC ## GET /api/me ### Description Retrieve profile information about the authenticated account. ### Method GET ### Endpoint https://serv.amazingmarvin.com/api/me ### Response #### Success Response (200) - **email** (string) - The user's email address. - **emailConfirmed** (boolean) - Indicates if the email address has been confirmed. - **billingPeriod** (string) - The user's billing period (e.g., "YEAR"). - **marvinPoints** (number) - The user's total Marvin points. - **rewardPointsEarned** (number) - The total reward points earned by the user. - **rewardPointsSpent** (number) - The total reward points spent by the user. #### Response Example ```json { "email": "user@example.com", "emailConfirmed": true, "billingPeriod": "YEAR", "marvinPoints": 12500, "rewardPointsEarned": 150.5, "rewardPointsSpent": 50.0 } ``` ``` -------------------------------- ### GET /api/todayItems Source: https://context7.com/pakrentos/marvinapi-wiki/llms.txt Retrieve all tasks and projects scheduled for today, including rollover items and auto-scheduled due items. ```APIDOC ## GET /api/todayItems ### Description Retrieve all tasks and projects scheduled for today, including rollover items and auto-scheduled due items. ### Method GET ### Endpoint https://serv.amazingmarvin.com/api/todayItems ### Parameters #### Query Parameters - **date** (string) - Optional - The date for which to retrieve items (YYYY-MM-DD). If not provided, defaults to the current date. #### Headers - **X-Date** (string) - Optional - The date for which to retrieve items (YYYY-MM-DD). Can be used as an alternative to the `date` query parameter. ### Request Example ```bash # Using query parameter curl -X GET \ -H "X-API-Token: YOUR_API_TOKEN" \ "https://serv.amazingmarvin.com/api/todayItems?date=2024-01-15" # Using header curl -X GET \ -H "X-API-Token: YOUR_API_TOKEN" \ -H "X-Date: 2024-01-15" \ https://serv.amazingmarvin.com/api/todayItems ``` ### Response #### Success Response (200) - **_id** (string) - The unique identifier of the item. - **title** (string) - The title of the item. - **day** (string) - The date the item is scheduled for (YYYY-MM-DD). - **done** (boolean) - Indicates if the item is completed. #### Response Example ```json [ { "_id": "task1", "title": "Morning standup", "day": "2024-01-15", "done": false }, { "_id": "task2", "title": "Code review", "day": "2024-01-15", "done": false } ] ``` ``` -------------------------------- ### Get Due Items via API Source: https://context7.com/pakrentos/marvinapi-wiki/llms.txt Fetches all open tasks and projects that are due on or before a specified date. The date can be provided using the 'by' query parameter. ```bash curl -X GET \ -H "X-API-Token: YOUR_API_TOKEN" \ "https://serv.amazingmarvin.com/api/dueItems?by=2024-01-15" ``` -------------------------------- ### POST /api/track Source: https://context7.com/pakrentos/marvinapi-wiki/llms.txt Control time tracking for a specific task. Valid actions are "START" and "STOP". ```APIDOC ## POST /api/track ### Description Control time tracking for a specific task. Valid actions are "START" and "STOP". ### Method POST ### Endpoint https://serv.amazingmarvin.com/api/track ### Parameters #### Request Body - **taskId** (string) - Required - The ID of the task to track time for. - **action** (string) - Required - The action to perform ('START' or 'STOP'). ### Request Example ```bash # Start tracking curl -X POST \ -H "X-API-Token: YOUR_API_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "taskId": "task_abc123", "action": "START" }' \ https://serv.amazingmarvin.com/api/track # Stop tracking curl -X POST \ -H "X-API-Token: YOUR_API_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "taskId": "task_abc123", "action": "STOP" }' \ https://serv.amazingmarvin.com/api/track ``` ### Response #### Success Response (200) - **startId** (string) - The ID of the task for which tracking was started. - **startTimes** (array) - An array of timestamps when tracking started. - **stopId** (string) - The ID of the task for which tracking was stopped (if applicable). - **stopTimes** (array) - An array of timestamps when tracking stopped (if applicable). - **issues** (array) - An array of any issues encountered during the operation. #### Response Example ```json { "startId": "task_abc123", "startTimes": [1595791080814], "stopId": null, "stopTimes": [], "issues": [] } ``` ``` -------------------------------- ### Get Labels via API Source: https://context7.com/pakrentos/marvinapi-wiki/llms.txt Retrieves all available labels, ordered according to their configuration. The response includes label details like ID, title, color, icon, and group ID. ```bash curl -X GET \ -H "X-API-Token: YOUR_API_TOKEN" \ https://serv.amazingmarvin.com/api/labels ``` -------------------------------- ### GET /api/children Source: https://context7.com/pakrentos/marvinapi-wiki/llms.txt Retrieve all child tasks and projects of a specific category or project by its parent ID. ```APIDOC ## GET /api/children ### Description Retrieve all child tasks and projects of a specific category or project by its parent ID. ### Method GET ### Endpoint https://serv.amazingmarvin.com/api/children ### Parameters #### Query Parameters - **parentId** (string) - Required - The ID of the parent item. Use 'unassigned' for inbox items. #### Headers - **X-Parent-Id** (string) - Optional - The ID of the parent item. Can be used as an alternative to the `parentId` query parameter. ### Request Example ```bash # Get inbox items (unassigned) curl -X GET \ -H "X-API-Token: YOUR_API_TOKEN" \ "https://serv.amazingmarvin.com/api/children?parentId=unassigned" # Get children of a specific project curl -X GET \ -H "X-API-Token: YOUR_API_TOKEN" \ -H "X-Parent-Id: project_abc123" \ https://serv.amazingmarvin.com/api/children ``` ### Response #### Success Response (200) - **_id** (string) - The unique identifier of the child item. - **title** (string) - The title of the child item. - **parentId** (string) - The ID of the parent item. - **db** (string) - The database where the item is stored. - **type** (string) - The type of the item (e.g., 'task', 'project'). #### Response Example ```json [ { "_id": "task1", "title": "Subtask 1", "parentId": "project_abc123", "db": "Tasks" }, { "_id": "proj1", "title": "Sub-project", "parentId": "project_abc123", "db": "Categories", "type": "project" } ] ``` ``` -------------------------------- ### Get Categories via API Source: https://context7.com/pakrentos/marvinapi-wiki/llms.txt Fetches a list of all categories within the user's account, including their metadata such as ID, title, parent ID, and color. ```bash curl -X GET \ -H "X-API-Token: YOUR_API_TOKEN" \ https://serv.amazingmarvin.com/api/categories ``` -------------------------------- ### Get All Reminders Source: https://context7.com/pakrentos/marvinapi-wiki/llms.txt Retrieves all currently scheduled reminders. This endpoint requires a full access token to access reminder data. ```bash curl -X GET \ -H "X-Full-Access-Token: YOUR_FULL_ACCESS_TOKEN" \ https://serv.amazingmarvin.com/api/reminders # Response: # [ # { # "time": 1678098457, # "reminderId": "reminder_uuid_12345", # "type": "T", # "title": "Team meeting", # "snooze": 9 # } # ] ``` -------------------------------- ### Create a Project API Source: https://context7.com/pakrentos/marvinapi-wiki/llms.txt Create a new project container that can hold tasks and sub-projects with scheduling and priority options. ```APIDOC ## POST /api/addProject ### Description Creates a new project to organize tasks and sub-projects. ### Method POST ### Endpoint `/api/addProject` ### Parameters #### Headers - **X-API-Token** (string) - Required - Your API token. - **Content-Type** (string) - Required - `application/json` #### Request Body - **title** (string) - Required - The title of the project. - **done** (boolean) - Optional - Whether the project is completed. Defaults to `false`. - **day** (string) - Optional - The date the project is scheduled for (YYYY-MM-DD). - **dueDate** (string) - Optional - The due date for the project (YYYY-MM-DD). - **priority** (string) - Optional - Priority level of the project (e.g., "high", "medium", "low"). - **note** (string) - Optional - Additional notes for the project. - **plannedMonth** (string) - Optional - The month the project is planned for (YYYY-MM). - **timeZoneOffset** (integer) - Optional - The user's timezone offset in minutes. ### Request Example ```json { "title": "Q1 Marketing Campaign", "done": false, "day": "2024-01-10", "dueDate": "2024-03-31", "priority": "high", "note": "Launch new product line marketing", "plannedMonth": "2024-01", "timeZoneOffset": -480 } ``` ### Response #### Success Response (200) - **itemId** (string) - The ID of the newly created project. - **message** (string) - Confirmation message. #### Response Example ```json { "itemId": "new_project_id_456", "message": "Project created successfully" } ``` ``` -------------------------------- ### Create Project Source: https://context7.com/pakrentos/marvinapi-wiki/llms.txt Creates a new project container with a title, scheduling options, and priority. Used to group tasks and sub-projects. ```bash curl -X POST \ -H "X-API-Token: YOUR_API_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "title": "Q1 Marketing Campaign", "done": false, "day": "2024-01-10", "dueDate": "2024-03-31", "priority": "high", "note": "Launch new product line marketing", "plannedMonth": "2024-01", "timeZoneOffset": -480 }' \ https://serv.amazingmarvin.com/api/addProject ``` -------------------------------- ### Get Goals API Source: https://github.com/pakrentos/marvinapi-wiki/blob/master/Marvin-API.md Retrieves a list of goals via a GET request to the /api/goals endpoint. Requires an API token. Returns an array of goal objects. ```HTTP GET /api/goals X-API-Token: XYZ => [{ _id: "123", title: "Example Goal", ... }] ``` -------------------------------- ### Create Document using Marvin API Source: https://github.com/pakrentos/marvinapi-wiki/blob/master/Marvin-API.md Allows the creation of any document within Marvin using a `fullAccessToken`. It's crucial to include `createdAt` for proper display and to ensure the document structure is valid to prevent Marvin from crashing. Invalid documents may require deletion or update to fix. ```HTTP POST /api/doc/create X-Full-Access-Token: ABC { "_id": "xy12n3i123", "db": "Tasks", "title": "Example task", "done": false, "createdAt": 1649150426400 } => { "_id": "xy12n3i123", "_rev": "1-xyz", "title": "Example task", "done": false, "createdAt": 1649150426400 } ``` -------------------------------- ### POST /api/doc/create Source: https://github.com/pakrentos/marvinapi-wiki/blob/master/Marvin-API.md Creates a new document within Marvin. It's recommended to include `createdAt` for proper display. Use with caution as invalid documents can cause Marvin to crash. ```APIDOC ## POST /api/doc/create ### Description Creates a new document within Marvin. It's recommended to include `createdAt` for proper display. Use with caution as invalid documents can cause Marvin to crash. ### Method POST ### Endpoint /api/doc/create ### Headers - **X-Full-Access-Token** (string) - Required - The full access token for authentication. ### Request Body - **_id** (string) - Required - The unique identifier for the document. - **db** (string) - Required - The database name where the document will be stored. - **title** (string) - Required - The title of the document. - **done** (boolean) - Optional - Indicates if the task is done. - **createdAt** (number) - Optional - Timestamp for when the document was created. ### Request Example ```json { "_id": "xy12n3i123", "db": "Tasks", "title": "Example task", "done": false, "createdAt": 1649150426400 } ``` ### Response #### Success Response (200) - **_id** (string) - The unique identifier of the created document. - **_rev** (string) - The revision identifier of the created document. - **title** (string) - The title of the document. - **done** (boolean) - Indicates if the task is done. - **createdAt** (number) - Timestamp for when the document was created. #### Response Example ```json { "_id": "xy12n3i123", "_rev": "1-xyz", "title": "Example task", "done": false, "createdAt": 1649150426400 } ``` ``` -------------------------------- ### Example Task JSON with Subtasks Source: https://github.com/pakrentos/marvinapi-wiki/blob/master/Marvin-Data-Types.md An example JSON object illustrating a task that contains subtasks. This demonstrates how subtasks are nested within the 'subtasks' property of a task, with each subtask identified by its unique ID. ```json { "createdAt": 1612975446890, "db": "Tasks", "title": "Example task", "parentId": "unassigned", "day": "2021-02-10", "subtasks": { "3JTpZf4WnWvrK": { "_id": "3JTpZf4WnWvrK", "title": "Subtask 1", "done": false, "rank": 1 }, "eM93my8kteDMw": { "_id": "eM93my8kteDMw", "title": "Subtask 2", "done": false, "rank": 2 } }, "_id": "dKG245maqNRkn58Z9SyT", "_rev": "7-f2f224e38fd775ab49774cad0455559a" } ``` -------------------------------- ### Get Single Habit API Source: https://github.com/pakrentos/marvinapi-wiki/blob/master/Marvin-API.md Retrieves a single habit, including its full history, via a GET request to the /api/habit endpoint with a provided ID. Requires an API token. Returns a habit object. ```HTTP GET /api/habit?id=abc X-API-Token: XYZ => {...} ``` -------------------------------- ### POST /api/doc/create Source: https://context7.com/pakrentos/marvinapi-wiki/llms.txt Create a new document of any type directly in the database with full control over all fields. ```APIDOC ## POST /api/doc/create ### Description Create a new document of any type directly in the database with full control over all fields. ### Method POST ### Endpoint https://serv.amazingmarvin.com/api/doc/create ### Parameters #### Request Body - **_id** (string) - Required - The unique identifier for the document. - **db** (string) - Required - The database where the document will be stored. - **title** (string) - Required - The title of the document. - **done** (boolean) - Optional - Indicates if the task is completed. - **parentId** (string) - Optional - The ID of the parent item. - **day** (string) - Optional - The date associated with the document (YYYY-MM-DD). - **createdAt** (integer) - Optional - Timestamp for when the document was created. ### Request Example ```json { "_id": "custom_task_id_12345", "db": "Tasks", "title": "Custom API task", "done": false, "parentId": "unassigned", "day": "2024-01-15", "createdAt": 1649150426400 } ``` ### Response #### Success Response (200) - **_id** (string) - The unique identifier of the created document. - **_rev** (string) - The revision identifier of the document. - **db** (string) - The database where the document was stored. - **title** (string) - The title of the document. - **done** (boolean) - Indicates if the task is completed. - **createdAt** (integer) - Timestamp for when the document was created. #### Response Example ```json { "_id": "custom_task_id_12345", "_rev": "1-abc", "db": "Tasks", "title": "Custom API task", "done": false, "createdAt": 1649150426400 } ``` ``` -------------------------------- ### Webhook Configuration API Source: https://github.com/pakrentos/marvinapi-wiki/blob/master/Webhooks.md This section details how to configure webhooks, either through the Marvin UI or programmatically via the API by editing the `profile.strategySettings.webhooks` array. ```APIDOC ## Webhook Configuration ### Description Configure Webhooks to have Marvin contact your server when certain actions are taken within Marvin. This allows for real-time integration with external systems. ### Method API (via `profile.strategySettings.webhooks` array) or UI Configuration ### Endpoint `profile.strategySettings.webhooks` (for API configuration) ### Parameters #### Request Body (for API configuration - array of webhook objects) - **type** (string) - Required - One of the following: `"add"`, `"addTask"`, `"addProject"`, `"edit"`, `"editTask"`, `"editProject"`, `"markDone"`, `"markDoneTask"`, `"markDoneProject"`, `"delete"`, `"deleteTask"`, `"deleteProject"`, `"startTracking"`, `"stopTracking"`, `"addTimer"`, `"pauseTimer"`, `"resumeTimer"`, `"deleteTimer"`, `"timerDone"`, `"addHabit"`, `"editHabit"`, `"recordHabit"`, `"deleteHabit"` - **smartListId** (string) - Optional - A smart list, label, or project ID used to filter which tasks/projects trigger the webhook. - **method** (string) - Required - One of: `"GET"`, `"POST"`, or `"PUT"`. - **url** (string) - Required - The full URL of the webhook endpoint (e.g., `"https://example.com:8080/api/v2/marvinTask"`). - **headers** (object) - Optional - Any additional headers to send with the webhook request (e.g., authentication headers). ### Request Example (API Configuration - single webhook object) ```json { "type": "addTask", "smartListId": "some-smart-list-id", "method": "POST", "url": "https://your-server.com/marvin-webhook", "headers": { "Authorization": "Bearer YOUR_API_KEY" } } ``` ### Response #### Success Response (200) Configuration is typically saved directly within Marvin's settings. API responses would indicate success or failure of the update operation. #### Response Example (Illustrative - actual response depends on API implementation) ```json { "status": "success", "message": "Webhook configuration updated." } ``` ### Error Handling - **400 Bad Request**: Invalid webhook configuration parameters. - **401 Unauthorized**: Authentication failed if sending via API with invalid credentials. - **500 Internal Server Error**: Marvin encountered an issue processing the request. ``` -------------------------------- ### Create a Task API Source: https://context7.com/pakrentos/marvinapi-wiki/llms.txt Create a new task with optional scheduling, labels, time estimates, and other metadata. The title supports autocompletion syntax. ```APIDOC ## POST /api/addTask ### Description Creates a new task with various optional fields and autocompletion support in the title. ### Method POST ### Endpoint `/api/addTask` ### Parameters #### Headers - **X-API-Token** (string) - Required - Your API token. - **X-Auto-Complete** (boolean) - Optional - Set to `false` to disable autocompletion. Defaults to `true`. - **Content-Type** (string) - Required - `application/json` #### Request Body - **title** (string) - Required - The title of the task, supporting autocompletion syntax. - **done** (boolean) - Optional - Whether the task is completed. Defaults to `false`. - **day** (string) - Optional - The date the task is scheduled for (YYYY-MM-DD). - **dueDate** (string) - Optional - The due date for the task (YYYY-MM-DD). - **timeEstimate** (integer) - Optional - Estimated time for the task in milliseconds. - **note** (string) - Optional - Additional notes for the task. - **isStarred** (integer) - Optional - Star level for the task (e.g., 3). - **dailySection** (string) - Optional - The section of the day the task belongs to (e.g., "Morning"). - **timeZoneOffset** (integer) - Optional - The user's timezone offset in minutes. ### Request Example ```json { "title": "Complete project report #Work @urgent", "done": false, "day": "2024-01-15", "dueDate": "2024-01-20", "timeEstimate": 3600000, "note": "Include quarterly metrics and forecasts", "isStarred": 3, "dailySection": "Morning", "timeZoneOffset": -480 } ``` ### Response #### Success Response (200) - **itemId** (string) - The ID of the newly created task. - **message** (string) - Confirmation message. #### Response Example ```json { "itemId": "new_task_id_123", "message": "Task created successfully" } ``` ``` -------------------------------- ### Read Document by ID using GET Request Source: https://github.com/pakrentos/marvinapi-wiki/blob/master/Marvin-API.md This API allows retrieval of any document from the CouchDB database using its ID via a GET request. It requires the 'X-Full-Access-Token' header. The response returns the entire document, including metadata like '_id', '_rev', and 'val'. ```http GET /api/doc?id=strategySettings.labelSettings.groups X-Full-Access-Token: ABC => { "_id" : "strategySettings.labelSettings.groups", "_rev" : "12-8dcc836705e9f1ae98f1525092b82b31", "createdAt" : 1564154150216, "db" : "ProfileItems", "fieldUpdates" : { "createdAt" : 1568180186429, "db" : 1568180586429, "updatedAt" : 1568180536429, "val" : 1582132559581 }, "updatedAt" : 1582132559548, "val" : { "84fYiqsxgZadr" : { "_id" : "81fYbqsxGZadr", "createdAt" : 1564159272192, "icon" : "cxicons8-circled-7", "isExclusive" : false, "isMenu" : true, "rank" : 4, "title" : "numbers" } } } ``` -------------------------------- ### Create Project using POST Request Source: https://github.com/pakrentos/marvinapi-wiki/blob/master/Marvin-API.md This endpoint allows for the creation of a new project via a POST request. It accepts a JSON payload with various fields to define the project's properties, such as title, dates, labels, and priorities. Ensure the request includes the 'X-API-Token' header. ```http POST /api/addProject X-API-Token: XYZ { "done": false, "day": "2020-07-17", "title": "Work 30m homework #School", // supports some autocompletion (parent, dueDate, labels) "parentId": "xyz", // ID of parent category/project "labelIds": ["abc", "def"], // IDs of labels "firstScheduled": "2020-07-17", "rank": 999, "dailySection": "Morning", "bonusSection": "Essential", // or "Bonus" "customSection": "a3gnaiN31mz", // ID of custom section (from profile.strategySettings.customStructure) "timeBlockSection": "b00m3feaMbeaz", // ID of time block "note": "Problems 1-4", "dueDate": "2020-07-20", "timeEstimate": 3600000, // ms "isReward": false, "priority": "high", // "high", "mid", or "low" "isFrogged": 2, "plannedWeek": "2020-07-12", "plannedMonth": "2020-07", "rewardPoints": 1.25, "rewardId": "anbeN3mRneam", // Unique ID of attached Reward "backburner": true, // Manually put in backburner (can also be backburner from label, start date, etc.) "reviewDate": "2020-09-09", "timeEstimate": 300000, // duration estimate in ms "itemSnoozeTime": 1599577206923, // Date.now() until when it's snoozed "permaSnoozeTime": "09:00", // Time offset in minutes // // Added to time to fix time zone issues. So if the user is in Pacific time, // this would be -8*60. If the user added a task with +today at 22:00 local // time 2019-12-05, then we want to create the task on 2019-12-05 and not // 2019-12-06 (which is the server date). "timeZoneOffset": 60 } ``` -------------------------------- ### Create Document via API Source: https://context7.com/pakrentos/marvinapi-wiki/llms.txt Creates a new document of any type directly in the database. Requires a full access token and provides control over all document fields. The response includes the document ID and revision. ```bash curl -X POST \ -H "X-Full-Access-Token: YOUR_FULL_ACCESS_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "_id": "custom_task_id_12345", "db": "Tasks", "title": "Custom API task", "done": false, "parentId": "unassigned", "day": "2024-01-15", "createdAt": 1649150426400 }' \ https://serv.amazingmarvin.com/api/doc/create ``` -------------------------------- ### Tracking Webhooks Source: https://github.com/pakrentos/marvinapi-wiki/blob/master/Webhooks.md Webhooks related to starting and stopping time tracking for tasks. ```APIDOC ## Webhook Types: Tracking ### Description These webhooks are triggered when time tracking is initiated or stopped for a task. ### Method POST (typically, for webhook payloads) ### Endpoints `/webhook` (example endpoint, actual endpoint may vary) ### Event Types * **`"startTracking"`**: Triggered when you start tracking a task. The entire task object is sent. * **`"stopTracking"`**: Triggered when you stop tracking a task. The entire task object is sent, including updated `times` and `duration` fields. ### Request Body Example (for `"stopTracking"` event) ```json { "id": "task456", "title": "Develop feature X", "times": [ {"start": 1678886400000, "end": 1678890000000} ], "duration": 3600000 } ``` ### Response (Webhooks typically return a 2xx status code to acknowledge receipt. Specific response details depend on the receiving service.) ``` -------------------------------- ### GET /api/doc Source: https://github.com/pakrentos/marvinapi-wiki/blob/master/Marvin-API.md Retrieves any individual document from the CouchDB database by its ID. ```APIDOC ## GET /api/doc ### Description Retrieves any individual document from the CouchDB database by its ID. This endpoint previously only worked for `ProfileItems` but now returns the entire document for all types. ### Method GET ### Endpoint /api/doc ### Query Parameters - **id** (string) - Required - The ID of the document to retrieve. ### Headers - **X-Full-Access-Token** (string) - Required - Full access token for authentication. ### Response #### Success Response (200) - **_id** (string) - The unique identifier of the document. - **_rev** (string) - The revision identifier of the document. - **createdAt** (integer) - Timestamp when the document was created. - **db** (string) - The database where the document resides. - **fieldUpdates** (object) - Object containing details about field updates. - **updatedAt** (integer) - Timestamp when the document was last updated. - **val** (any) - The value of the document (structure depends on the document type). #### Response Example ```json { "_id" : "strategySettings.labelSettings.groups", "_rev" : "12-8dcc836705e9f1ae98f1525092b82b31", "createdAt" : 1564154150216, "db" : "ProfileItems", "fieldUpdates" : { "createdAt" : 1568180186429, "db" : 1568180586429, "updatedAt" : 1568180536429, "val" : 1582132559581 }, "updatedAt" : 1582132559548, "val" : { "84fYiqsxgZadr" : { "_id" : "81fYbqsxGZadr", "createdAt" : 1564159272192, "icon" : "cxicons8-circled-7", "isExclusive" : false, "isMenu" : true, "rank" : 4, "title" : "numbers" } } } ``` ``` -------------------------------- ### Create Task Source: https://context7.com/pakrentos/marvinapi-wiki/llms.txt Creates a new task with various optional parameters like title, due date, time estimate, and notes. Supports autocompletion syntax in the title. Can be disabled with an 'X-Auto-Complete: false' header. ```bash curl -X POST \ -H "X-API-Token: YOUR_API_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "title": "Complete project report #Work @urgent", "done": false, "day": "2024-01-15", "dueDate": "2024-01-20", "timeEstimate": 3600000, "note": "Include quarterly metrics and forecasts", "isStarred": 3, "dailySection": "Morning", "timeZoneOffset": -480 }' \ https://serv.amazingmarvin.com/api/addTask # Disable autocompletion with header: curl -X POST \ -H "X-API-Token: YOUR_API_TOKEN" \ -H "X-Auto-Complete: false" \ -H "Content-Type: application/json" \ -d '{"title": "Task with literal #hashtag +today"}' \ https://serv.amazingmarvin.com/api/addTask ```