--- openapi: 3.0.0 info: version: 0.6.0 title: Playbooks API contact: name: Mattermost url: https://mattermost.com/ email: support@mattermost.com servers: - url: http://localhost:8065/plugins/playbooks/api/v0 paths: /plugins/playbooks/api/v0/runs: get: summary: List all playbook runs description: Retrieve a paged list of playbook runs, filtered by team, status, owner, name and/or members, and sorted by ID, name, status, creation date, end date, team or owner ID. operationId: listPlaybookRuns security: - BearerAuth: [] tags: - PlaybookRuns parameters: - name: team_id in: query description: ID of the team to filter by. required: true example: el3d3t9p55pevvxs2qkdwz334k schema: type: string - name: page in: query description: Zero-based index of the page to request. required: false example: 3 schema: type: integer format: int32 default: 0 - name: per_page in: query description: Number of playbook runs to return per page. required: false example: 50 schema: type: integer format: int32 default: 1000 - name: sort in: query description: Field to sort the returned playbook runs by. required: false example: end_at schema: type: string default: create_at enum: - id - name - is_active - create_at - end_at - team_id - owner_user_id - name: direction in: query description: Direction (ascending or descending) followed by the sorting of the playbook runs. required: false example: asc schema: type: string default: desc enum: - desc - asc - name: statuses in: query description: The returned list will contain only the playbook runs with the specified statuses. required: false example: InProgress schema: type: array default: - InProgress items: type: string enum: - InProgress - Finished style: form explode: true - name: owner_user_id in: query description: The returned list will contain only the playbook runs commanded by this user. Specify "me" for current user. required: false example: lpn2ogt9qzkc59lfvvad9t15v4 schema: type: string - name: participant_id in: query description: The returned list will contain only the playbook runs for which the given user is a participant. Specify "me" for current user. required: false example: bruhg1cs65retdbea798hrml4v schema: type: string - name: search_term in: query description: The returned list will contain only the playbook runs whose name contains the search term. required: false example: server down schema: type: string x-codeSamples: - lang: curl source: | curl -X GET 'http://localhost:8065/plugins/playbooks/api/v0/runs' \ -H 'Authorization: Bearer 9g64ig7q9pds8yjz8rsgd6e36e' responses: 200: description: A paged list of playbook runs. content: application/json: schema: $ref: "#/components/schemas/PlaybookRunList" 400: $ref: "#/components/responses/400" 403: $ref: "#/components/responses/403" 500: $ref: "#/components/responses/500" post: summary: Create a new playbook run description: Create a new playbook run in a team, using a playbook as template, with a specific name and a specific owner. operationId: createPlaybookRunFromPost security: - BearerAuth: [] tags: - PlaybookRuns requestBody: description: Playbook run payload. content: application/json: schema: type: object required: - name - owner_user_id - team_id - playbook_id properties: name: type: string description: The name of the playbook run. example: Server down in EU cluster description: type: string description: The description of the playbook run. example: There is one server in the EU cluster that is not responding since April 12. owner_user_id: type: string description: The identifier of the user who is commanding the playbook run. example: bqnbdf8uc0a8yz4i39qrpgkvtg team_id: type: string description: The identifier of the team where the playbook run's channel is in. example: 61ji2mpflefup3cnuif80r5rde post_id: type: string description: If the playbook run was created from a post, this field contains the identifier of such post. If not, this field is empty. example: b2ntfcrl4ujivl456ab4b3aago playbook_id: type: string description: The identifier of the playbook with from which this playbook run was created. example: 0y4a0ntte97cxvfont8y84wa7x x-codeSamples: - lang: curl source: | curl -X POST 'http://localhost:8065/plugins/playbooks/api/v0/runs' \ -H 'Authorization: Bearer 9g64ig7q9pds8yjz8rsgd6e36e'\ -H 'Content-Type: application/json'\ -d '{"name": "Server down in EU cluster", "description": "There is one server in the EU cluster that is not responding since April 12.", "owner_user_id": "bqnbdf8uc0a8yz4i39qrpgkvtg", "team_id": "61ji2mpflefup3cnuif80r5rde", "playbook_id": "0y4a0ntte97cxvfont8y84wa7x"}' responses: 201: description: Created playbook run. headers: Location: description: Location of the created playbook run. schema: type: string example: /api/v0/runs/nhkx1nbivu45lr84vtxxukp2vr content: application/json: schema: $ref: "#/components/schemas/PlaybookRun" 400: $ref: "#/components/responses/400" 403: $ref: "#/components/responses/403" 500: $ref: "#/components/responses/500" /plugins/playbooks/api/v0/runs/dialog: post: summary: Create a new playbook run from dialog description: This is an internal endpoint to create a playbook run from the submission of an interactive dialog, filled by a user in the webapp. See [Interactive Dialogs](https://docs.mattermost.com/developer/interactive-dialogs.html) for more information. operationId: createPlaybookRunFromDialog security: - BearerAuth: [] tags: - Internal requestBody: description: Dialog submission payload. content: application/json: schema: type: object properties: type: type: string example: dialog_submission url: type: string callback_id: type: string description: Callback ID provided by the integration. state: type: string description: Stringified JSON with the post_id and the client_id. user_id: type: string description: ID of the user who submitted the dialog. channel_id: type: string description: ID of the channel the user was in when submitting the dialog. team_id: type: string description: ID of the team the user was on when submitting the dialog. submission: type: object description: Map of the dialog fields to their values required: - playbookID - playbookRunName properties: playbookID: type: string description: ID of the playbook to create the playbook run from. example: ahz0s61gh275i7z2ag4g1ntvjm playbookRunName: type: string description: The name of the playbook run to be created. example: Server down in EU cluster. playbookRunDescription: type: string description: An optional description of the playbook run. example: There is one server in the EU cluster that is not responding since April 12. cancelled: type: boolean description: If the dialog was cancelled. responses: 201: description: Created playbook run. headers: Location: description: Location of the created playbook run. schema: type: string example: /api/v0/runs/nhkx1nbivu45lr84vtxxukp2vr content: application/json: schema: $ref: "#/components/schemas/PlaybookRun" 400: $ref: "#/components/responses/400" 403: $ref: "#/components/responses/403" 500: $ref: "#/components/responses/500" /plugins/playbooks/api/v0/runs/owners: get: summary: Get all owners description: Get the owners of all playbook runs, filtered by team. operationId: getOwners security: - BearerAuth: [] tags: - PlaybookRuns parameters: - name: team_id in: query description: ID of the team to filter by. required: true example: el3d3t9p55pevvxs2qkdwz334k schema: type: string x-codeSamples: - lang: curl source: | curl -X GET 'http://localhost:8065/plugins/playbooks/api/v0/runs/owners?team_id=ni8duypfe7bamprxqeffd563gy' \ -H 'Authorization: Bearer 9g64ig7q9pds8yjz8rsgd6e36e' responses: 200: description: A list of owners. content: application/json: schema: type: array items: $ref: "#/components/schemas/OwnerInfo" 400: $ref: "#/components/responses/400" 403: $ref: "#/components/responses/403" 500: $ref: "#/components/responses/500" /plugins/playbooks/api/v0/runs/channels: get: summary: Get playbook run channels description: Get all channels associated with a playbook run, filtered by team, status, owner, name and/or members, and sorted by ID, name, status, creation date, end date, team, or owner ID. operationId: getChannels security: - BearerAuth: [] tags: - PlaybookRuns parameters: - name: team_id in: query description: ID of the team to filter by. required: true example: el3d3t9p55pevvxs2qkdwz334k schema: type: string - name: sort in: query description: Field to sort the returned channels by, according to their playbook run. required: false example: end_at schema: type: string default: create_at enum: - id - name - create_at - end_at - team_id - owner_user_id - name: direction in: query description: Direction (ascending or descending) followed by the sorting of the playbook runs associated to the channels. required: false example: asc schema: type: string default: desc enum: - desc - asc - name: status in: query description: The returned list will contain only the channels whose playbook run has this status. required: false example: active schema: type: string default: all enum: - all - InProgress - Finished - name: owner_user_id in: query description: The returned list will contain only the channels whose playbook run is commanded by this user. required: false example: lpn2ogt9qzkc59lfvvad9t15v4 schema: type: string - name: search_term in: query description: The returned list will contain only the channels associated to a playbook run whose name contains the search term. required: false example: server down schema: type: string - name: participant_id in: query description: The returned list will contain only the channels associated to a playbook run for which the given user is a participant. required: false example: bruhg1cs65retdbea798hrml4v schema: type: string x-codeSamples: - lang: curl source: | curl -X GET 'http://localhost:8065/plugins/playbooks/api/v0/runs/channels?team_id=ni8duypfe7bamprxqeffd563gy' \ -H 'Authorization: Bearer 9g64ig7q9pds8yjz8rsgd6e36e' responses: 200: description: Channel IDs. content: application/json: schema: type: array items: type: string description: ID of the channel. example: v8zdc1893plelmf54vb7f0ramn 400: $ref: "#/components/responses/400" 403: $ref: "#/components/responses/403" 500: $ref: "#/components/responses/500" /plugins/playbooks/api/v0/runs/checklist-autocomplete: get: summary: Get autocomplete data for /playbook check description: This is an internal endpoint used by the autocomplete system to retrieve the data needed to show the list of items that the user can check. operationId: getChecklistAutocomplete security: - BearerAuth: [] tags: - Internal parameters: - name: channel_ID in: query description: ID of the channel the user is in. required: true example: r3vk8jdys4rlya46xhdthatoyx schema: type: string responses: 200: description: List of autocomplete items for this channel. content: application/json: schema: type: array items: type: object required: - item - hint - helptext properties: item: type: string description: A string containing a pair of integers separated by a space. The first integer is the index of the checklist; the second is the index of the item within the checklist. example: 1 2 hint: type: string description: The title of the corresponding item. example: Gather information from customer. helptext: type: string description: Always the value "Check/uncheck this item". example: Check/uncheck this item 500: $ref: "#/components/responses/500" /plugins/playbooks/api/v0/runs/channel/{channel_id}: get: summary: Find playbook run by channel ID operationId: getPlaybookRunByChannelId security: - BearerAuth: [] tags: - PlaybookRuns parameters: - name: channel_id in: path required: true description: ID of the channel associated to the playbook run to retrieve. schema: type: string example: hwrmiyzj3kadcilh3ukfcnsbt6 x-codeSamples: - lang: curl source: | curl -X GET 'http://localhost:8065/plugins/playbooks/api/v0/runs/channel/hwrmiyzj3kadcilh3ukfcnsbt6' \ -H 'Authorization: Bearer 9g64ig7q9pds8yjz8rsgd6e36e' responses: 200: description: Playbook run associated to the channel. content: application/json: schema: $ref: "#/components/schemas/PlaybookRun" 404: $ref: "#/components/responses/404" 500: $ref: "#/components/responses/500" /plugins/playbooks/api/v0/runs/{id}: get: summary: Get a playbook run operationId: getPlaybookRun security: - BearerAuth: [] tags: - PlaybookRuns parameters: - name: id in: path required: true description: ID of the playbook run to retrieve. schema: type: string example: mx3xyzdojfgyfdx8sc8of1gdme x-codeSamples: - lang: curl source: | curl -X GET 'http://localhost:8065/plugins/playbooks/api/v0/runs/mx3xyzdojfgyfdx8sc8of1gdme' \ -H 'Authorization: Bearer 9g64ig7q9pds8yjz8rsgd6e36e' responses: 200: description: Playbook run content: application/json: schema: $ref: "#/components/schemas/PlaybookRun" 403: $ref: "#/components/responses/403" 500: $ref: "#/components/responses/500" patch: summary: Update a playbook run operationId: updatePlaybookRun security: - BearerAuth: [] tags: - PlaybookRuns parameters: - name: id in: path required: true description: ID of the playbook run to retrieve. schema: type: string example: mx3xyzdojfgyfdx8sc8of1gdme requestBody: description: Playbook run update payload. content: application/json: schema: type: object properties: active_stage: type: integer description: Zero-based index of the stage that will be made active. example: 2 x-codeSamples: - lang: curl source: | curl -X PATCH 'http://localhost:8065/plugins/playbooks/api/v0/runs/mx3xyzdojfgyfdx8sc8of1gdme' \ -H 'Authorization: Bearer 9g64ig7q9pds8yjz8rsgd6e36e'\ -H 'Content-Type: application/json'\ -d '{"active_stage": 2}' responses: 200: description: Playbook run successfully updated. 400: $ref: "#/components/responses/400" 500: $ref: "#/components/responses/500" /plugins/playbooks/api/v0/runs/{id}/metadata: get: summary: Get playbook run metadata operationId: getPlaybookRunMetadata security: - BearerAuth: [] tags: - PlaybookRuns parameters: - name: id in: path required: true description: ID of the playbook run whose metadata will be retrieved. schema: type: string example: mx3xyzdojfgyfdx8sc8of1gdme x-codeSamples: - lang: curl source: | curl -X GET 'http://localhost:8065/plugins/playbooks/api/v0/runs/1igmynxs77ywmcbwbsujzktter/details' \ -H 'Authorization: Bearer 9g64ig7q9pds8yjz8rsgd6e36e' responses: 200: description: Playbook run metadata. content: application/json: schema: $ref: "#/components/schemas/PlaybookRunMetadata" 403: $ref: "#/components/responses/403" 500: $ref: "#/components/responses/500" /plugins/playbooks/api/v0/runs/{id}/end: put: summary: End a playbook run operationId: endPlaybookRun security: - BearerAuth: [] tags: - PlaybookRuns parameters: - name: id in: path required: true description: ID of the playbook run to end. schema: type: string example: 1igmynxs77ywmcbwbsujzktter x-codeSamples: - lang: curl source: | curl -X PUT 'http://localhost:8065/plugins/playbooks/api/v0/runs/1igmynxs77ywmcbwbsujzktter/end' \ -H 'Authorization: Bearer 9g64ig7q9pds8yjz8rsgd6e36e' responses: 200: description: Playbook run ended 500: $ref: "#/components/responses/500" post: summary: End a playbook run from dialog description: This is an internal endpoint to end a playbook run via a confirmation dialog, submitted by a user in the webapp. operationId: endPlaybookRunDialog security: - BearerAuth: [] tags: - Internal parameters: - name: id in: path required: true description: ID of the playbook run to end. schema: type: string example: 1igmynxs77ywmcbwbsujzktter x-codeSamples: - lang: curl source: | curl -X POST 'http://localhost:8065/plugins/playbooks/api/v0/runs/1igmynxs77ywmcbwbsujzktter/end' \ -H 'Authorization: Bearer 9g64ig7q9pds8yjz8rsgd6e36e' responses: 200: description: Playbook run ended 500: $ref: "#/components/responses/500" /plugins/playbooks/api/v0/runs/{id}/restart: put: summary: Restart a playbook run operationId: restartPlaybookRun security: - BearerAuth: [] tags: - PlaybookRuns parameters: - name: id in: path required: true description: ID of the playbook run to restart. schema: type: string example: 1igmynxs77ywmcbwbsujzktter x-codeSamples: - lang: curl source: | curl -X PUT 'http://localhost:8065/plugins/playbooks/api/v0/runs/1igmynxs77ywmcbwbsujzktter/end' \ -H 'Authorization: Bearer 9g64ig7q9pds8yjz8rsgd6e36e' responses: 200: description: Playbook run restarted. 500: $ref: "#/components/responses/500" /plugins/playbooks/api/v0/runs/{id}/status: post: summary: Update a playbook run's status operationId: status security: - BearerAuth: [] tags: - PlaybookRuns parameters: - name: id in: path required: true description: ID of the playbook run to update. schema: type: string example: 1igmynxs77ywmcbwbsujzktter requestBody: description: Payload to change the playbook run's status update message. content: application/json: schema: type: object properties: message: type: string description: The status update message. example: Starting to investigate. reminder: type: number description: The number of seconds until the system will send a reminder to the owner to update the status. No reminder will be scheduled if reminder is 0 or omitted. example: 600 required: - description - message x-codeSamples: - lang: curl source: | curl -X PUT 'http://localhost:8065/plugins/playbooks/api/v0/runs/1igmynxs77ywmcbwbsujzktter/update-status' \ -H 'Authorization: Bearer 9g64ig7q9pds8yjz8rsgd6e36e' -d '{"message": "Finishing playbook run because the issue was solved."}' responses: 200: description: Playbook run updated. 400: $ref: "#/components/responses/400" 403: $ref: "#/components/responses/403" 500: $ref: "#/components/responses/500" /plugins/playbooks/api/v0/runs/{id}/finish: put: summary: Finish a playbook operationId: finish security: - BearerAuth: [] tags: - PlaybookRuns parameters: - name: id in: path required: true description: ID of the playbook run to finish. schema: type: string example: 1igmynxs77ywmcbwbsujzktter x-codeSamples: - lang: curl source: | curl -X PUT 'http://localhost:8065/plugins/playbooks/api/v0/runs/1igmynxs77ywmcbwbsujzktter/finish' \ -H 'Authorization: Bearer 9g64ig7q9pds8yjz8rsgd6e36e' responses: 200: description: Playbook run finished. 500: $ref: "#/components/responses/500" /plugins/playbooks/api/v0/runs/{id}/owner: post: summary: Update playbook run owner operationId: changeOwner security: - BearerAuth: [] tags: - PlaybookRuns parameters: - name: id in: path required: true description: ID of the playbook run whose owner will be changed. schema: type: string example: 1igmynxs77ywmcbwbsujzktter requestBody: description: Payload to change the playbook run's owner. content: application/json: schema: type: object properties: owner_id: type: string description: The user ID of the new owner. example: hx7fqtqxp7nn8129t7e505ls6s required: - owner_id x-codeSamples: - lang: curl source: | curl -X POST 'http://localhost:8065/plugins/playbooks/api/v0/runs/1igmynxs77ywmcbwbsujzktter/owner' \ -H 'Authorization: Bearer 9g64ig7q9pds8yjz8rsgd6e36e'\ -d '{"owner_id": "hx7fqtqxp7nn8129t7e505ls6s"}' responses: 200: description: Owner successfully changed. 400: $ref: "#/components/responses/400" 403: $ref: "#/components/responses/403" 500: $ref: "#/components/responses/500" /plugins/playbooks/api/v0/runs/{id}/next-stage-dialog: post: summary: Go to next stage from dialog description: This is an internal endpoint to go to the next stage via a confirmation dialog, submitted by a user in the webapp. operationId: nextStageDialog security: - BearerAuth: [] tags: - Internal parameters: - in: path name: id schema: type: string required: true description: The PlaybookRun ID requestBody: description: Dialog submission payload. content: application/json: schema: type: object properties: state: type: string description: String representation of the zero-based index of the stage to go to. example: "3" responses: 200: description: Playbook run stage update. 400: $ref: "#/components/responses/400" 500: $ref: "#/components/responses/500" /plugins/playbooks/api/v0/runs/{id}/checklists/{checklist}/add: post: summary: Add an item to a playbook run's checklist description: The most common pattern to add a new item is to only send its title as the request payload. By default, it is an open item, with no assignee and no slash command. operationId: addChecklistItem security: - BearerAuth: [] tags: - PlaybookRuns parameters: - name: id in: path required: true description: ID of the playbook run whose checklist will be modified. example: twcqg0a2m37ydi6ebge3j9ev5z schema: type: string - name: checklist in: path required: true description: Zero-based index of the checklist to modify. example: 1 schema: type: integer requestBody: description: Checklist item payload. content: application/json: schema: type: object required: - title properties: title: type: string description: The title of the checklist item. example: Gather information from customer. state: type: string enum: - "" - in_progress - closed description: The state of the checklist item. An empty string means that the item is not done. example: closed state_modified: type: integer format: int64 description: The timestamp for the latest modification of the item's state, formatted as the number of milliseconds since the Unix epoch. It equals 0 if the item was never modified. example: 1607774621321 assignee_id: type: string description: The identifier of the user that has been assigned to complete this item. If the item has no assignee, this is an empty string. example: pisdatkjtdlkdhht2v4inxuzx1 assignee_modified: type: integer format: int64 description: The timestamp for the latest modification of the item's assignee, formatted as the number of milliseconds since the Unix epoch. It equals 0 if the item never got an assignee. example: 1608897821125 command: type: string description: The slash command associated with this item. If the item has no slash command associated, this is an empty string example: /opsgenie on-call command_last_run: type: integer format: int64 description: The timestamp for the latest execution of the item's command, formatted as the number of milliseconds since the Unix epoch. It equals 0 if the command was never executed. example: 1608552221019 description: type: string description: A detailed description of the checklist item, formatted with Markdown. example: Ask the customer for more information in [Zendesk](https://www.zendesk.com/). x-codeSamples: - lang: curl source: | curl -X PUT 'http://localhost:8065/plugins/playbooks/api/v0/runs/twcqg0a2m37ydi6ebge3j9ev5z/checklists/1/add' \ -H 'Authorization: Bearer 9g64ig7q9pds8yjz8rsgd6e36e'\ -d '{"title": "Gather information from customer."}' responses: 200: description: Item successfully added. default: description: Error response content: application/json: schema: $ref: "#/components/schemas/Error" /plugins/playbooks/api/v0/runs/{id}/checklists/{checklist}/reorder: put: summary: Reorder an item in a playbook run's checklist operationId: reoderChecklistItem security: - BearerAuth: [] tags: - PlaybookRuns parameters: - name: id in: path required: true description: ID of the playbook run whose checklist will be modified. example: yj74zsk7dvtsv6ndsynsps3g5s schema: type: string - name: checklist in: path required: true description: Zero-based index of the checklist to modify. example: 1 schema: type: integer requestBody: description: Reorder checklist item payload. content: application/json: schema: type: object properties: item_num: type: integer description: Zero-based index of the item to reorder. example: 2 new_location: type: integer description: Zero-based index of the new place to move the item to. example: 2 required: - item_num - new_location x-codeSamples: - lang: curl source: | curl -X PUT 'http://localhost:8065/plugins/playbooks/api/v0/runs/yj74zsk7dvtsv6ndsynsps3g5s/checklists/1/reorder' \ -H 'Authorization: Bearer 9g64ig7q9pds8yjz8rsgd6e36e'\ -d '{"item_num": 0, "new_location": 2}' responses: 200: description: Item successfully reordered. 400: $ref: "#/components/responses/400" 500: $ref: "#/components/responses/500" /plugins/playbooks/api/v0/runs/{id}/checklists/{checklist}/item/{item}: put: summary: Update an item of a playbook run's checklist description: Update the title and the slash command of an item in one of the playbook run's checklists. operationId: itemRename security: - BearerAuth: [] tags: - PlaybookRuns parameters: - name: id in: path required: true description: ID of the playbook run whose checklist will be modified. example: 6t7jdgyqr7b5sk24zkauhmrb06 schema: type: string - name: checklist in: path required: true description: Zero-based index of the checklist to modify. example: 1 schema: type: integer - name: item in: path required: true description: Zero-based index of the item to modify. example: 2 schema: type: integer requestBody: description: Update checklist item payload. content: application/json: schema: type: object properties: title: type: string description: The new title of the item. example: Gather information from server's logs. command: type: string description: The new slash command of the item. example: /jira update ticket required: - title - command x-codeSamples: - lang: curl source: | curl -X PUT 'http://localhost:8065/plugins/playbooks/api/v0/runs/6t7jdgyqr7b5sk24zkauhmrb06/checklists/1/item/0' \ -H 'Authorization: Bearer 9g64ig7q9pds8yjz8rsgd6e36e'\ -d '{"title": "Gather information from server's logs.", "command": "/jira update ticket"}' responses: 200: description: Item updated. 400: $ref: "#/components/responses/400" 500: $ref: "#/components/responses/500" delete: summary: Delete an item of a playbook run's checklist operationId: itemDelete security: - BearerAuth: [] tags: - PlaybookRuns parameters: - name: id in: path required: true description: ID of the playbook run whose checklist will be modified. example: zjy2q2iy2jafl0lo2oddos5xn7 schema: type: string - name: checklist in: path required: true description: Zero-based index of the checklist to modify. example: 1 schema: type: integer - name: item in: path required: true description: Zero-based index of the item to modify. example: 2 schema: type: integer x-codeSamples: - lang: curl source: | curl -X DELETE 'http://localhost:8065/plugins/playbooks/api/v0/runs/zjy2q2iy2jafl0lo2oddos5xn7/checklists/1/item/2' \ -H 'Authorization: Bearer 9g64ig7q9pds8yjz8rsgd6e36e' responses: 204: description: Item successfully deleted. 400: $ref: "#/components/responses/400" 500: $ref: "#/components/responses/500" /plugins/playbooks/api/v0/runs/{id}/checklists/{checklist}/item/{item}/state: put: summary: Update the state of an item operationId: itemSetState security: - BearerAuth: [] tags: - PlaybookRuns parameters: - name: id in: path required: true description: ID of the playbook run whose checklist will be modified. example: 7l37isroz4e63giev62hs318bn schema: type: string - name: checklist in: path required: true description: Zero-based index of the checklist to modify. example: 1 schema: type: integer - name: item in: path required: true description: Zero-based index of the item to modify. example: 2 schema: type: integer requestBody: description: Update checklist item's state payload. content: application/json: schema: type: object properties: new_state: type: string description: The new state of the item. enum: - "" - in_progress - closed example: closed default: "" required: - new_state x-codeSamples: - lang: curl source: | curl -X PUT 'http://localhost:8065/plugins/playbooks/api/v0/runs/7l37isroz4e63giev62hs318bn/checklists/1/item/2/state' \ -H 'Authorization: Bearer 9g64ig7q9pds8yjz8rsgd6e36e' -d '{"new_state": "closed"}' responses: 200: description: Item's state successfully updated. 400: $ref: "#/components/responses/400" 500: $ref: "#/components/responses/500" /plugins/playbooks/api/v0/runs/{id}/checklists/{checklist}/item/{item}/assignee: put: summary: Update the assignee of an item operationId: itemSetAssignee security: - BearerAuth: [] tags: - PlaybookRuns parameters: - name: id in: path required: true description: ID of the playbook run whose item will get a new assignee. example: 7l37isroz4e63giev62hs318bn schema: type: string - name: checklist in: path required: true description: Zero-based index of the checklist whose item will get a new assignee. example: 1 schema: type: integer - name: item in: path required: true description: Zero-based index of the item that will get a new assignee. example: 2 schema: type: integer requestBody: description: User ID of the new assignee. content: application/json: schema: type: object properties: assignee_id: type: string description: The user ID of the new assignee of the item. example: ruu86intseidqdxjojia41u7l1 required: - assignee_id x-codeSamples: - lang: curl source: | curl -X PUT 'http://localhost:8065/plugins/playbooks/api/v0/runs/7l37isroz4e63giev62hs318bn/checklists/1/item/2/assignee' \ -H 'Authorization: Bearer 9g64ig7q9pds8yjz8rsgd6e36e' -d '{"asignee_id": "ruu86intseidqdxjojia41u7l1"}' responses: 200: description: Item's assignee successfully updated. 400: $ref: "#/components/responses/400" 500: $ref: "#/components/responses/500" /plugins/playbooks/api/v0/runs/{id}/checklists/{checklist}/item/{item}/run: put: summary: Run an item's slash command operationId: itemRun security: - BearerAuth: [] tags: - PlaybookRuns parameters: - name: id in: path required: true description: ID of the playbook run whose item will be executed. example: 7l37isroz4e63giev62hs318bn schema: type: string - name: checklist in: path required: true description: Zero-based index of the checklist whose item will be executed. example: 1 schema: type: integer - name: item in: path required: true description: Zero-based index of the item whose slash command will be executed. example: 2 schema: type: integer x-codeSamples: - lang: curl source: | curl -X POST 'http://localhost:8065/plugins/playbooks/api/v0/runs/7l37isroz4e63giev62hs318bn/checklists/1/item/2/run' \ -H 'Authorization: Bearer 9g64ig7q9pds8yjz8rsgd6e36e' responses: 200: description: Item's slash command successfully executed. content: application/json: schema: $ref: "#/components/schemas/TriggerIdReturn" 400: $ref: "#/components/responses/400" 500: $ref: "#/components/responses/500" /plugins/playbooks/api/v0/runs/{id}/timeline/{event_id}/: delete: summary: Remove a timeline event from the playbook run operationId: removeTimelineEvent security: - BearerAuth: [] tags: - Timeline parameters: - name: id in: path required: true description: ID of the playbook run whose timeline event will be modified. example: zjy2q2iy2jafl0lo2oddos5xn7 schema: type: string - name: event_id in: path required: true description: ID of the timeline event to be deleted example: craxgf4r4trgzrtues3a1t74ac schema: type: string x-codeSamples: - lang: curl source: | curl -X DELETE 'http://localhost:8065/plugins/playbooks/api/v0/runs/zjy2q2iy2jafl0lo2oddos5xn7/timeline/craxgf4r4trgzrtues3a1t74ac' \ -H 'Authorization: Bearer 9g64ig7q9pds8yjz8rsgd6e36e' responses: 204: description: Item successfully deleted. 400: $ref: "#/components/responses/400" 500: $ref: "#/components/responses/500" /plugins/playbooks/api/v0/playbooks: get: summary: List all playbooks description: Retrieve a paged list of playbooks, filtered by team, and sorted by title, number of stages or number of steps. operationId: getPlaybooks security: - BearerAuth: [] tags: - Playbooks parameters: - name: team_id in: query description: ID of the team to filter by. required: true example: 08fmfasq5wit3qyfmq4mjk0rto schema: type: string - name: page in: query description: Zero-based index of the page to request. required: false example: 3 schema: type: integer format: int32 default: 0 - name: per_page in: query description: Number of playbooks to return per page. required: false example: 50 schema: type: integer format: int32 default: 1000 - name: sort in: query description: Field to sort the returned playbooks by title, number of stages or total number of steps. required: false example: stages schema: type: string default: title enum: - title - stages - steps - name: direction in: query description: Direction (ascending or descending) followed by the sorting of the playbooks. required: false example: asc schema: type: string default: asc enum: - desc - asc - name: with_archived in: query description: Includes archived playbooks in the result. required: false example: true schema: type: boolean default: false x-codeSamples: - lang: curl source: | curl -X GET 'http://localhost:8065/plugins/playbooks/api/v0/playbooks?team_id=08fmfasq5wit3qyfmq4mjk0rto&sort=title&direction=asc' \ -H 'Authorization: Bearer 9g64ig7q9pds8yjz8rsgd6e36e' responses: 200: description: A paged list of playbooks. content: application/json: schema: $ref: "#/components/schemas/PlaybookList" 400: $ref: "#/components/responses/400" 403: $ref: "#/components/responses/403" 500: $ref: "#/components/responses/500" post: summary: Create a playbook operationId: createPlaybook security: - BearerAuth: [] tags: - Playbooks requestBody: description: Playbook content: application/json: schema: type: object required: - title - team_id - create_public_playbook_run - checklists - member_ids properties: title: type: string description: The title of the playbook. example: Cloud PlaybookRuns description: type: string description: The description of the playbook. example: A playbook to follow when there is a playbook run regarding the availability of the cloud service. team_id: type: string description: The identifier of the team where the playbook is in. example: p03rbi6viyztysbqnkvcqyel2i create_public_playbook_run: type: boolean description: A boolean indicating whether the playbook runs created from this playbook should be public or private. example: true public: type: boolean description: A boolean indicating whether the playbook is licensed as public or private. Required 'true' for free tier. example: true checklists: type: array description: The stages defined by this playbook. items: type: object required: - title - items properties: title: type: string description: The title of the checklist. example: Triage issue items: type: array description: The list of tasks to do. items: type: object required: - title properties: title: type: string description: The title of the checklist item. example: Gather information from customer. command: type: string description: The slash command associated with this item. If the item has no slash command associated, this is an empty string example: /opsgenie on-call description: type: string description: A detailed description of the checklist item, formatted with Markdown. example: Ask the customer for more information in [Zendesk](https://www.zendesk.com/). member_ids: description: The identifiers of all the users that are members of this playbook. type: array items: type: string description: User ID of the playbook member. example: ilh6s1j4yefbdhxhtlzt179i6m broadcast_channel_ids: description: The IDs of the channels where all the status updates will be broadcasted. The team of the broadcast channel must be the same as the playbook's team. type: array items: type: string description: ID of the broadcast channel. example: 2zh7rpashwfwapwaqyslmhwbax invited_user_ids: description: A list with the IDs of the members to be automatically invited to the playbook run's channel as soon as the playbook run is created. type: array items: type: string description: User ID of the member to be invited. example: 01kidjn9iozv7bist427w4gkjo invite_users_enabled: description: Boolean that indicates whether the members declared in invited_user_ids will be automatically invited. type: boolean example: true default_owner_id: description: User ID of the member that will be automatically assigned as owner as soon as the playbook run is created. If the member is not part of the playbook run's channel or is not included in the invited_user_ids list, they will be automatically invited to the channel. type: string example: 9dtruav6d9ce3oqnc5pwhtqtfq default_owner_enabled: description: Boolean that indicates whether the member declared in default_owner_id will be automatically assigned as owner. type: string example: true announcement_channel_id: description: ID of the channel where the playbook run will be automatically announced as soon as the playbook run is created. type: string example: 8iofau5swv32l6qtk3vlxgobta announcement_channel_enabled: description: Boolean that indicates whether the playbook run creation will be announced in the channel declared in announcement_channel_id. type: boolean example: true webhook_on_creation_url: description: An absolute URL where a POST request will be sent as soon as the playbook run is created. The allowed protocols are HTTP and HTTPS. type: string example: https://httpbin.org/post webhook_on_creation_enabled: description: Boolean that indicates whether the webhook declared in webhook_on_creation_url will be automatically sent. type: boolean example: true webhook_on_status_update_url: description: An absolute URL where a POST request will be sent as soon as the playbook run's status is updated. The allowed protocols are HTTP and HTTPS. type: string example: https://httpbin.org/post webhook_on_status_update_enabled: description: Boolean that indicates whether the webhook declared in webhook_on_status_update_url will be automatically sent. type: boolean example: true x-codeSamples: - lang: curl source: | curl -X POST 'http://localhost:8065/plugins/playbooks/api/v0/playbooks' \ -H 'Authorization: Bearer 9g64ig7q9pds8yjz8rsgd6e36e'\ -d '{"title": "Cloud PlaybookRuns", "description": "A playbook to follow when there is a playbook run regarding the availability of the cloud service.", "team_id": "p03rbi6viyztysbqnkvcqyel2i","create_public_playbook_run": true,"checklists": [{"title": "Triage issue","items": [{"title": "Gather information from customer."}]}]}' callbacks: playbookRunCreation: "{$request.body#/webhook_on_creation_url}": post: summary: PlaybookRun's creation outgoing webhook. description: When a playbook run is created with this playbook, a POST request is sent to the URL configured in webhook_on_creation_url. The webhook is considered successful if your server returns a response code within the 200-299 range. Otherwise, the webhook is considered failed, and a warning message is posted in the playbook run's channel. No retries are made. operationId: webhookOncreation requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/WebhookOnCreationPayload" responses: "2XX": description: Your server returns a 2XX code if it successfully received the request. playbookRunStatusUpdate: "{$request.body#/webhook_on_status_update_url}": post: summary: PlaybookRun's status update outgoing webhook. description: When a playbook run's status is updated, a POST request is sent to the URL configured in webhook_on_status_update_url. The webhook is considered successful if your server returns a response code within the 200-299 range. Otherwise, the webhook is considered failed, and a warning message is posted in the playbook run's channel. No retries are made. operationId: webhookOnStatusUpdate requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/WebhookOnStatusUpdatePayload" responses: "2XX": description: Your server returns a 2XX code if it successfully received the request. responses: 201: description: ID of the created playbook. headers: Location: description: Location of the created playbook. schema: type: string example: /api/v0/playbook/cdl5o0tjcp5rqlpjidhobj64nd content: application/json: schema: type: object properties: id: type: string example: iz0g457ikesz55dhxcfa0fk9yy required: - id 400: $ref: "#/components/responses/400" 403: $ref: "#/components/responses/403" 500: $ref: "#/components/responses/500" /plugins/playbooks/api/v0/playbooks/{id}: get: summary: Get a playbook operationId: getPlaybook security: - BearerAuth: [] tags: - Playbooks parameters: - name: id in: path required: true description: ID of the playbook to retrieve. schema: type: string example: iz0g457ikesz55dhxcfa0fk9yy x-codeSamples: - lang: curl source: | curl -X GET 'http://localhost:8065/plugins/playbooks/api/v0/playbooks/iz0g457ikesz55dhxcfa0fk9yy' \ -H 'Authorization: Bearer 9g64ig7q9pds8yjz8rsgd6e36e' responses: 200: description: Playbook. content: application/json: schema: $ref: "#/components/schemas/Playbook" 403: $ref: "#/components/responses/403" 500: $ref: "#/components/responses/500" put: summary: Update a playbook operationId: updatePlaybook security: - BearerAuth: [] tags: - Playbooks parameters: - name: id in: path required: true description: ID of the playbook to update. schema: type: string example: iz0g457ikesz55dhxcfa0fk9yy requestBody: description: Playbook payload content: application/json: schema: $ref: "#/components/schemas/Playbook" x-codeSamples: - lang: curl source: | curl -X PUT 'http://localhost:8065/plugins/playbooks/api/v0/playbooks/iz0g457ikesz55dhxcfa0fk9yy' \ -H 'Authorization: Bearer 9g64ig7q9pds8yjz8rsgd6e36e'\ -d '{"title": "Playbook","team_id": "ni8duypfe7bamprxqeffd563gy","create_public_playbook_run": true,"checklists": [{"title": "Title","items": [{"title": "Title"}]}]}' responses: 200: description: Playbook succesfully updated. 400: $ref: "#/components/responses/400" 403: $ref: "#/components/responses/403" 500: $ref: "#/components/responses/500" delete: summary: Delete a playbook operationId: deletePlaybook security: - BearerAuth: [] tags: - Playbooks parameters: - name: id in: path required: true description: ID of the playbook to delete. schema: type: string example: iz0g457ikesz55dhxcfa0fk9yy x-codeSamples: - lang: curl source: | curl -X DELETE 'http://localhost:8065/plugins/playbooks/api/v0/playbooks/iz0g457ikesz55dhxcfa0fk9yy' \ -H 'Authorization: Bearer 9g64ig7q9pds8yjz8rsgd6e36e' responses: 204: description: Playbook successfully deleted. 403: $ref: "#/components/responses/403" 500: $ref: "#/components/responses/500" /plugins/playbooks/api/v0/playbooks/{id}/autofollows: get: summary: Get the list of followers' user IDs of a playbook operationId: getAutoFollows security: - BearerAuth: [] tags: - PlaybookAutofollows parameters: - name: id in: path required: true description: ID of the playbook to retrieve followers from. schema: type: string example: iz0g457ikesz55dhxcfa0fk9yy x-codeSamples: - lang: curl source: | curl -X GET 'http://localhost:8065/plugins/playbooks/api/v0/playbooks/iz0g457ikesz55dhxcfa0fk9yy/autofollows' \ -H 'Authorization: Bearer 9g64ig7q9pds8yjz8rsgd6e36e' responses: 200: description: List of the user IDs who follow the playbook. content: application/json: schema: $ref: "#/components/schemas/PlaybookAutofollows" 403: $ref: "#/components/responses/403" 500: $ref: "#/components/responses/500" components: securitySchemes: BearerAuth: type: http scheme: bearer responses: 400: content: application/json: schema: $ref: "#/components/schemas/Error" description: The request is malformed. 403: content: application/json: schema: $ref: "#/components/schemas/Error" description: Access to the resource is forbidden for this user. 404: content: application/json: schema: $ref: "#/components/schemas/Error" description: Resource requested not found. 500: content: application/json: schema: $ref: "#/components/schemas/Error" description: There was an internal error in the server. schemas: PlaybookRun: type: object properties: id: type: string description: A unique, 26 characters long, alphanumeric identifier for the playbook run. example: mx3xyzdojfgyfdx8sc8of1gdme name: type: string description: The name of the playbook run. example: Server down in EU cluster description: type: string description: The description of the playbook run. example: There is one server in the EU cluster that is not responding since April 12. is_active: type: boolean description: True if the playbook run is ongoing; false if the playbook run is ended. example: false owner_user_id: type: string description: The identifier of the user that is commanding the playbook run. example: bqnbdf8uc0a8yz4i39qrpgkvtg team_id: type: string description: The identifier of the team where the playbook run's channel is in. example: 61ji2mpflefup3cnuif80r5rde channel_id: type: string description: The identifier of the playbook run's channel. example: hwrmiyzj3kadcilh3ukfcnsbt6 create_at: type: integer format: int64 description: The playbook run creation timestamp, formatted as the number of milliseconds since the Unix epoch. example: 1606807976289 end_at: type: integer format: int64 description: The playbook run finish timestamp, formatted as the number of milliseconds since the Unix epoch. It equals 0 if the playbook run is not finished. example: 0 delete_at: type: integer format: int64 description: The playbook run deletion timestamp, formatted as the number of milliseconds since the Unix epoch. It equals 0 if the playbook run is not deleted. example: 0 active_stage: type: integer format: int32 description: Zero-based index of the currently active stage. example: 1 active_stage_title: type: string description: The title of the currently active stage. example: Triage issue post_id: type: string description: If the playbook run was created from a post, this field contains the identifier of such post. If not, this field is empty. example: b2ntfcrl4ujivl456ab4b3aago playbook_id: type: string description: The identifier of the playbook with from which this playbook run was created. example: 0y4a0ntte97cxvfont8y84wa7x checklists: type: array items: $ref: "#/components/schemas/Checklist" PlaybookRunMetadata: type: object properties: channel_name: type: string description: Name of the channel associated to the playbook run. example: server-down-in-eu-cluster channel_display_name: type: string description: Display name of the channel associated to the playbook run. example: Server down in EU cluster team_name: type: string description: Name of the team the playbook run is in. example: sre-staff num_members: type: integer format: int64 description: Number of users that have been members of the playbook run at any point. example: 25 total_posts: type: integer format: int64 description: Number of posts in the channel associated to the playbook run. example: 202 PlaybookRunList: type: object properties: total_count: type: integer description: The total number of playbook runs in the list, regardless of the paging. format: int32 example: 305 page_count: type: integer description: The total number of pages. This depends on the total number of playbook runs in the database and the per_page parameter sent with the request. format: int32 example: 2 has_more: type: boolean description: A boolean describing whether there are more pages after the currently returned. example: true items: type: array description: The playbook runs in this page. items: $ref: "#/components/schemas/PlaybookRun" PlaybookAutofollows: type: object properties: total_count: type: integer description: The total number of users who marked this playbook to auto-follow runs. format: int32 example: 12 items: type: array description: The user IDs of who marked this playbook to auto-follow. items: type: string OwnerInfo: type: object required: - user_id - username properties: user_id: type: string description: A unique, 26 characters long, alphanumeric identifier for the owner. example: ahz0s61gh275i7z2ag4g1ntvjm username: type: string description: Owner's username. example: aaron.medina TriggerIdReturn: type: object required: - trigger_id properties: trigger_id: type: string description: The trigger_id returned by the slash command. example: ceenjwsg6tgdzjpofxqemy1aio Playbook: type: object properties: id: type: string description: A unique, 26 characters long, alphanumeric identifier for the playbook. example: iz0g457ikesz55dhxcfa0fk9yy title: type: string description: The title of the playbook. example: Cloud PlaybookRuns description: type: string description: The description of the playbook. example: A playbook to follow when there is a playbook run regarding the availability of the cloud service. team_id: type: string description: The identifier of the team where the playbook is in. example: p03rbi6viyztysbqnkvcqyel2i create_public_playbook_run: type: boolean description: A boolean indicating whether the playbook runs created from this playbook should be public or private. example: true create_at: type: integer format: int64 description: The playbook creation timestamp, formatted as the number of milliseconds since the Unix epoch. example: 1602235338837 delete_at: type: integer format: int64 description: The playbook deletion timestamp, formatted as the number of milliseconds since the Unix epoch. It equals 0 if the playbook is not deleted. example: 0 num_stages: type: integer format: int64 description: The number of stages defined in this playbook. example: 3 num_steps: type: integer format: int64 description: The total number of steps from all the stages defined in this playbook. example: 18 checklists: type: array description: The stages defined in this playbook. items: $ref: "#/components/schemas/Checklist" member_ids: description: The identifiers of all the users that are members of this playbook. type: array items: type: string description: User ID of the playbook member. example: ilh6s1j4yefbdhxhtlzt179i6m PlaybookList: type: object properties: total_count: type: integer description: The total number of playbooks in the list, regardless of the paging. format: int32 example: 305 page_count: type: integer description: The total number of pages. This depends on the total number of playbooks in the database and the per_page parameter sent with the request. format: int32 example: 2 has_more: type: boolean description: A boolean describing whether there are more pages after the currently returned. example: true items: type: array description: The playbooks in this page. items: $ref: "#/components/schemas/Playbook" Checklist: type: object properties: id: type: string description: A unique, 26 characters long, alphanumeric identifier for the checklist. example: 6f6nsgxzoq84fqh1dnlyivgafd title: type: string description: The title of the checklist. example: Triage issue items: type: array description: The list of tasks to do. items: $ref: "#/components/schemas/ChecklistItem" ChecklistItem: type: object properties: id: type: string description: A unique, 26 characters long, alphanumeric identifier for the checklist item. example: 6f6nsgxzoq84fqh1dnlyivgafd title: type: string description: The title of the checklist item. example: Gather information from customer. state: type: string enum: - "" - in_progress - closed description: The state of the checklist item. An empty string means that the item is not done. example: closed state_modified: type: integer format: int64 description: The timestamp for the latest modification of the item's state, formatted as the number of milliseconds since the Unix epoch. It equals 0 if the item was never modified. example: 1607774621321 assignee_id: type: string description: The identifier of the user that has been assigned to complete this item. If the item has no assignee, this is an empty string. example: pisdatkjtdlkdhht2v4inxuzx1 assignee_modified: type: integer format: int64 description: The timestamp for the latest modification of the item's assignee, formatted as the number of milliseconds since the Unix epoch. It equals 0 if the item never got an assignee. example: 1608897821125 command: type: string description: The slash command associated with this item. If the item has no slash command associated, this is an empty string example: /opsgenie on-call command_last_run: type: integer format: int64 description: The timestamp for the latest execution of the item's command, formatted as the number of milliseconds since the Unix epoch. It equals 0 if the command was never executed. example: 1608552221019 description: type: string description: A detailed description of the checklist item, formatted with Markdown. example: Ask the customer for more information in [Zendesk](https://www.zendesk.com/). Error: type: object required: - error - details properties: error: type: string description: A message with the error description. example: Error retrieving the resource. details: type: string description: Further details on where and why this error happened. example: Specific details about the error, depending on the case. WebhookOnCreationPayload: allOf: - $ref: "#/components/schemas/PlaybookRun" - type: object properties: channel_url: type: string description: Absolute URL to the playbook run's channel. example: https://example.com/ad-1/channels/channel-name details_url: type: string description: Absolute URL to the playbook run's details. example: https://example.com/ad-1/playbooks/runs/playbookRunID WebhookOnStatusUpdatePayload: allOf: - $ref: "#/components/schemas/PlaybookRun" - type: object properties: channel_url: type: string description: Absolute URL to the playbook run's channel. example: https://example.com/ad-1/channels/channel-name details_url: type: string description: Absolute URL to the playbook run's details. example: https://example.com/ad-1/playbooks/runs/playbookRunID