> This page is for API Reference & Tools.

> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.moveworks.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.moveworks.com/_mcp/server.

# Create ticket workflow

POST https://api.moveworks.ai/configurations/v1alpha1/tool/ticket/workflows
Content-Type: application/json

Creates a ticket workflow and returns it with its server-assigned `id` and `version`.

Send the fields at the top level of the body. Don't send `id` or `version.num`; `version.change_description` is required.

Reference: https://docs.moveworks.com/api-reference/configuration-api/ticketing/ticket-workflows/create-ticket-workflow

## Authentication

- `Authorization` header (bearer token, required) — JWT bearer token authentication. Include the Configuration API key in the Authorization header as 'Bearer \<token>'.

## Request

### Body (application/json)

This endpoint expects a TicketWorkflowConfigCreate.

- `display_name` (string, required) — A readable name for the workflow.
- `version` (VersionCreate, required) — Document version. On update, send back the num from your last read.
- `connector_id` (string, optional) — The connector this workflow's actions run against. Cannot be changed after creation. ID of an existing connector (GET /configurations/v1alpha1/platform/connectors).
- `conditional_actions` (list of TicketWorkflowConditionalActionSettingsCreate, optional) — Groups of actions that run when their condition matches.
- `default_action` (TicketWorkflowDefaultActionSettingsCreate, optional) — The actions that run when no conditional action matches.

## Response

### 200

The created ticket workflow

- `id` (string, optional) — Unique identifier of this configuration, assigned by the server. Send it in update requests to identify the configuration.
- `display_name` (string, optional) — A readable name for the workflow.
- `connector_id` (string, optional) — The connector this workflow's actions run against. Cannot be changed after creation. ID of an existing connector (GET /configurations/v1alpha1/platform/connectors).
- `conditional_actions` (list of TicketWorkflowConditionalActionSettings, optional) — Groups of actions that run when their condition matches.
- `default_action` (TicketWorkflowDefaultActionSettings, optional) — The actions that run when no conditional action matches.
- `updated_time` (datetime, optional) — When the configuration was last updated.
- `updated_by` (string, optional) — Who last updated the configuration.
- `version` (Version, optional) — Document version. On update, send back the num from your last read.

## Errors

### 400 Bad Request Error

Bad request - the body breaks a rule in the schema (a missing required field, an unknown enum value, an invalid DSL or Data Mapper expression), `version.change_description` is missing, or an id in the body doesn't match the URL

- `error` (ErrorResponseError, required)

### 401 Unauthorized Error

Unauthorized - the `Authorization` header is missing or the token is invalid

- `error` (ErrorResponseError, required)

### 403 Forbidden Error

Forbidden - the API key isn't allowed to change this configuration, or the configuration is frozen for your organization

- `error` (ErrorResponseError, required)

### 409 Conflict Error

Conflict - `version.num` doesn't match the stored version (someone changed it since your last read; read it again and retry), or the item already exists

- `error` (ErrorResponseError, required)

### 429 Too Many Requests Error

Too many requests - the organization exceeded the Configuration API rate limit. Back off and retry.

- `error` (ErrorResponseError, required)

### 500 Internal Server Error

Internal server error - retry the request

- `error` (ErrorResponseError, required)

## Types

### VersionCreate

- `change_description` (string, required) — A short note describing this change. Required on every create and update.

### TicketWorkflowConditionalActionSettingsCreate

- `condition_dsl` (string, optional) — Moveworks DSL rule, evaluated against the ticket, that decides whether these actions run. Must be a valid MWDSL expression.
- `actions` (list of TicketWorkflowActionSettingsCreate, optional) — The ticketing actions to run when the condition matches.

### TicketWorkflowDefaultActionSettingsCreate

- `actions` (list of TicketWorkflowActionSettingsCreate, optional) — The ticketing actions to run when no condition matches.

### TicketWorkflowConditionalActionSettings

- `condition_dsl` (string, optional) — Moveworks DSL rule, evaluated against the ticket, that decides whether these actions run.
- `actions` (list of TicketWorkflowActionSettings, optional) — The ticketing actions to run when the condition matches.
- `item_ref` (string, optional) — Server-assigned identity of this list item. Leave it unset on create; on update, send back the value from your last read so the item is matched correctly.

### TicketWorkflowDefaultActionSettings

- `actions` (list of TicketWorkflowActionSettings, optional) — The ticketing actions to run when no condition matches.

### Version

- `num` (integer, optional) — Version number set by the server. On update, send the num from your last read; a stale num is rejected as a conflict.
- `change_description` (string, optional) — A short note describing this change. Required on every create and update.

### ErrorResponseError

- `code` (string, optional) — A machine-readable error code.
- `message` (string, optional) — What went wrong, and for a rejected field, which rule it broke.

### TicketWorkflowActionSettingsCreate

- `create_ticket_action` (GenerateTicketActionSettings, optional) — Creates a new ticket.
- `submit_form_action` (SubmitFormActionSettings, optional) — Submits a form, such as a catalog item, in the ticketing system.
- `fetch_single_ticket_action` (FetchSingleTicketActionSettings, optional) — Fetches a single ticket.
- `fetch_requestor_tickets_action` (FetchRequestorTicketsActionSettings, optional) — Fetches the requestor's tickets.
- `add_comment_action` (AddCommentActionSettings, optional) — Adds a comment to the ticket.
- `add_work_note_action` (AddWorkNoteActionSettings, optional) — Adds a work note to the ticket.
- `upload_attachments_action` (UploadAttachmentsActionSettings, optional) — Uploads attachments to the ticket.
- `update_fields_action` (UpdateFieldsActionSettings, optional) — Updates fields on the ticket.
- `update_state_action` (UpdateStateActionSettings, optional) — Changes the ticket's state.
- `update_assignment_action` (UpdateAssignmentActionSettings, optional) — Updates the ticket's assignment.
- `resolve_ticket_action` (ResolveTicketActionSettings, optional) — Resolves the ticket.
- `reopen_ticket_action` (ReopenTicketActionSettings, optional) — Reopens the ticket.
- `create_ticket_from_existing_ticket_action` (GenerateTicketFromExistingTicketActionSettings, optional) — Creates a new ticket based on an existing ticket.
- `submit_form_from_existing_ticket_action` (SubmitFormFromExistingTicketActionSettings, optional) — Submits a form based on an existing ticket.
- `raise_exception_action` (RaiseExceptionActionSettings, optional) — Stops the workflow by raising an error.

### TicketWorkflowActionSettings

- `create_ticket_action` (GenerateTicketActionSettings, optional) — Creates a new ticket.
- `submit_form_action` (SubmitFormActionSettings, optional) — Submits a form, such as a catalog item, in the ticketing system.
- `fetch_single_ticket_action` (FetchSingleTicketActionSettings, optional) — Fetches a single ticket.
- `fetch_requestor_tickets_action` (FetchRequestorTicketsActionSettings, optional) — Fetches the requestor's tickets.
- `add_comment_action` (AddCommentActionSettings, optional) — Adds a comment to the ticket.
- `add_work_note_action` (AddWorkNoteActionSettings, optional) — Adds a work note to the ticket.
- `upload_attachments_action` (UploadAttachmentsActionSettings, optional) — Uploads attachments to the ticket.
- `update_fields_action` (UpdateFieldsActionSettings, optional) — Updates fields on the ticket.
- `update_state_action` (UpdateStateActionSettings, optional) — Changes the ticket's state.
- `update_assignment_action` (UpdateAssignmentActionSettings, optional) — Updates the ticket's assignment.
- `resolve_ticket_action` (ResolveTicketActionSettings, optional) — Resolves the ticket.
- `reopen_ticket_action` (ReopenTicketActionSettings, optional) — Reopens the ticket.
- `create_ticket_from_existing_ticket_action` (GenerateTicketFromExistingTicketActionSettings, optional) — Creates a new ticket based on an existing ticket.
- `submit_form_from_existing_ticket_action` (SubmitFormFromExistingTicketActionSettings, optional) — Submits a form based on an existing ticket.
- `raise_exception_action` (RaiseExceptionActionSettings, optional) — Stops the workflow by raising an error.
- `item_ref` (string, optional) — Server-assigned identity of this list item. Leave it unset on create; on update, send back the value from your last read so the item is matched correctly.

### GenerateTicketActionSettings

- `ticket_destination_id` (string, optional) — The ticket destination where the ticket is created. ID of an existing ticket_integration_destination (GET /configurations/v1alpha1/tool/ticket/integration/destinations).
- `override_ticket_type` (string, optional) — The type of ticket to file, such as INCIDENT or REQUEST. If unset, the type chosen by triage is used.
- `additional_ticket_fields_bender` (GenerateTicketActionSettingsAdditionalTicketFieldsBender, optional) — Moveworks data mapping that sets additional fields in the ticket creation payload.

### SubmitFormActionSettings

- `output_bender` (SubmitFormActionSettingsOutputBender, optional) — Moveworks data mapping that sets the fields in the form submission payload.
- `service_now_form_details` (SnowFormDetailsSettings, optional) — Identifies the ServiceNow form to submit.
- `fresh_service_form_details` (FreshServiceFormDetailsSettings, optional) — Identifies the Freshservice form to submit.

### FetchSingleTicketActionSettings

### FetchRequestorTicketsActionSettings

### AddCommentActionSettings

### AddWorkNoteActionSettings

### UploadAttachmentsActionSettings

### UpdateFieldsActionSettings

- `additional_ticket_fields_bender` (UpdateFieldsActionSettingsAdditionalTicketFieldsBender, optional) — Moveworks data mapping that sets the ticket fields to update.

### UpdateStateActionSettings

- `override_target_state` (string, optional) — The state to set the ticket to, such as WIP, RESOLVED or CLOSED.

### UpdateAssignmentActionSettings

### ResolveTicketActionSettings

### ReopenTicketActionSettings

### GenerateTicketFromExistingTicketActionSettings

- `ticket_destination_id` (string, optional) — The ticket destination where the new ticket is created. ID of an existing ticket_integration_destination (GET /configurations/v1alpha1/tool/ticket/integration/destinations).
- `override_ticket_type` (string, optional) — The type of ticket to file, such as INCIDENT or REQUEST. If unset, the type chosen by triage is used.
- `output_bender` (GenerateTicketFromExistingTicketActionSettingsOutputBender, optional) — Moveworks data mapping that sets the fields used to create the new ticket from the existing ticket.
- `mark_as_user_created` (boolean, optional) — If true, tickets created by this action are eligible for ticket resolution.

### SubmitFormFromExistingTicketActionSettings

- `output_bender` (SubmitFormFromExistingTicketActionSettingsOutputBender, optional) — Moveworks data mapping that sets the fields used to submit the form from the existing ticket.
- `service_now_form_details` (SnowFormDetailsSettings, optional) — Identifies the ServiceNow form to submit.
- `fresh_service_form_details` (FreshServiceFormDetailsSettings, optional) — Identifies the Freshservice form to submit.

### RaiseExceptionActionSettings

- `override_mw_error_code` (integer, optional) — The error code to raise. If unset, a default error is raised.
- `override_mw_error_message` (string, optional) — The error message recorded in logs. If unset, a default message is used.

### GenerateTicketActionSettingsAdditionalTicketFieldsBender

Moveworks data mapping that sets additional fields in the ticket creation payload.

### SubmitFormActionSettingsOutputBender

Moveworks data mapping that sets the fields in the form submission payload.

### SnowFormDetailsSettings

- `catalog_item_id` (string, optional) — The ID of the ServiceNow Service Catalog item. Up to 128 characters.
- `record_producer_id` (string, optional) — The ID of the ServiceNow Record Producer. Up to 128 characters.

### FreshServiceFormDetailsSettings

- `service_item_catalog_id` (string, optional) — The display ID of the Freshservice Service Catalog item.

### UpdateFieldsActionSettingsAdditionalTicketFieldsBender

Moveworks data mapping that sets the ticket fields to update.

### GenerateTicketFromExistingTicketActionSettingsOutputBender

Moveworks data mapping that sets the fields used to create the new ticket from the existing ticket.

### SubmitFormFromExistingTicketActionSettingsOutputBender

Moveworks data mapping that sets the fields used to submit the form from the existing ticket.

## Examples

### Ticket Workflows endpoints_createTicketWorkflow_example

**Response**

```json
{
  "id": "3f6c1e2a-8b4d-4c7e-9a1f-2d5b6c7e8f90",
  "display_name": "example-name",
  "connector_id": "<connector-uuid>",
  "conditional_actions": [
    {
      "condition_dsl": "true",
      "actions": [
        {
          "create_ticket_action": {},
          "item_ref": "<string>"
        }
      ],
      "item_ref": "<string>"
    }
  ],
  "default_action": {
    "actions": [
      {
        "create_ticket_action": {},
        "item_ref": "<string>"
      }
    ]
  },
  "updated_time": "2026-11-12T18:04:11Z",
  "updated_by": "admin@example.com",
  "version": {
    "num": 1,
    "change_description": "Create ticket workflow"
  }
}
```

**SDK Code**

```python Ticket Workflows endpoints_createTicketWorkflow_example
import requests

url = "https://api.moveworks.ai/configurations/v1alpha1/tool/ticket/workflows"

headers = {"Authorization": "Bearer <token>"}

response = requests.post(url, headers=headers)

print(response.json())
```

```javascript Ticket Workflows endpoints_createTicketWorkflow_example
const url = 'https://api.moveworks.ai/configurations/v1alpha1/tool/ticket/workflows';
const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Ticket Workflows endpoints_createTicketWorkflow_example
package main

import (
	"fmt"
	"net/http"
	"io"
)

func main() {

	url := "https://api.moveworks.ai/configurations/v1alpha1/tool/ticket/workflows"

	req, _ := http.NewRequest("POST", url, nil)

	req.Header.Add("Authorization", "Bearer <token>")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby Ticket Workflows endpoints_createTicketWorkflow_example
require 'uri'
require 'net/http'

url = URI("https://api.moveworks.ai/configurations/v1alpha1/tool/ticket/workflows")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'

response = http.request(request)
puts response.read_body
```

```java Ticket Workflows endpoints_createTicketWorkflow_example
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.moveworks.ai/configurations/v1alpha1/tool/ticket/workflows")
  .header("Authorization", "Bearer <token>")
  .asString();
```

```php Ticket Workflows endpoints_createTicketWorkflow_example
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.moveworks.ai/configurations/v1alpha1/tool/ticket/workflows', [
  'headers' => [
    'Authorization' => 'Bearer <token>',
  ],
]);

echo $response->getBody();
```

```csharp Ticket Workflows endpoints_createTicketWorkflow_example
using RestSharp;

var client = new RestClient("https://api.moveworks.ai/configurations/v1alpha1/tool/ticket/workflows");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <token>");
IRestResponse response = client.Execute(request);
```

```swift Ticket Workflows endpoints_createTicketWorkflow_example
import Foundation

let headers = ["Authorization": "Bearer <token>"]

let request = NSMutableURLRequest(url: NSURL(string: "https://api.moveworks.ai/configurations/v1alpha1/tool/ticket/workflows")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```

### Create a ticket workflow

**Request**

```json
{
  "display_name": "example-name",
  "version": {
    "change_description": "Create ticket workflow"
  },
  "connector_id": "<connector-uuid>",
  "conditional_actions": [
    {
      "condition_dsl": "true",
      "actions": [
        {
          "create_ticket_action": {}
        }
      ]
    }
  ],
  "default_action": {
    "actions": [
      {
        "create_ticket_action": {}
      }
    ]
  }
}
```

**Response**

```json
{
  "id": "3f6c1e2a-8b4d-4c7e-9a1f-2d5b6c7e8f90",
  "display_name": "example-name",
  "connector_id": "<connector-uuid>",
  "conditional_actions": [
    {
      "condition_dsl": "true",
      "actions": [
        {
          "create_ticket_action": {},
          "item_ref": "<string>"
        }
      ],
      "item_ref": "<string>"
    }
  ],
  "default_action": {
    "actions": [
      {
        "create_ticket_action": {},
        "item_ref": "<string>"
      }
    ]
  },
  "updated_time": "2026-11-12T18:04:11Z",
  "updated_by": "admin@example.com",
  "version": {
    "num": 1,
    "change_description": "Create ticket workflow"
  }
}
```

**SDK Code**

```python Create a ticket workflow
import requests

url = "https://api.moveworks.ai/configurations/v1alpha1/tool/ticket/workflows"

payload = {
    "display_name": "example-name",
    "version": { "change_description": "Create ticket workflow" },
    "connector_id": "<connector-uuid>",
    "conditional_actions": [
        {
            "condition_dsl": "true",
            "actions": [{ "create_ticket_action": {} }]
        }
    ],
    "default_action": { "actions": [{ "create_ticket_action": {} }] }
}
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript Create a ticket workflow
const url = 'https://api.moveworks.ai/configurations/v1alpha1/tool/ticket/workflows';
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{"display_name":"example-name","version":{"change_description":"Create ticket workflow"},"connector_id":"<connector-uuid>","conditional_actions":[{"condition_dsl":"true","actions":[{"create_ticket_action":{}}]}],"default_action":{"actions":[{"create_ticket_action":{}}]}}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Create a ticket workflow
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.moveworks.ai/configurations/v1alpha1/tool/ticket/workflows"

	payload := strings.NewReader("{\n  \"display_name\": \"example-name\",\n  \"version\": {\n    \"change_description\": \"Create ticket workflow\"\n  },\n  \"connector_id\": \"<connector-uuid>\",\n  \"conditional_actions\": [\n    {\n      \"condition_dsl\": \"true\",\n      \"actions\": [\n        {\n          \"create_ticket_action\": {}\n        }\n      ]\n    }\n  ],\n  \"default_action\": {\n    \"actions\": [\n      {\n        \"create_ticket_action\": {}\n      }\n    ]\n  }\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Authorization", "Bearer <token>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby Create a ticket workflow
require 'uri'
require 'net/http'

url = URI("https://api.moveworks.ai/configurations/v1alpha1/tool/ticket/workflows")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"display_name\": \"example-name\",\n  \"version\": {\n    \"change_description\": \"Create ticket workflow\"\n  },\n  \"connector_id\": \"<connector-uuid>\",\n  \"conditional_actions\": [\n    {\n      \"condition_dsl\": \"true\",\n      \"actions\": [\n        {\n          \"create_ticket_action\": {}\n        }\n      ]\n    }\n  ],\n  \"default_action\": {\n    \"actions\": [\n      {\n        \"create_ticket_action\": {}\n      }\n    ]\n  }\n}"

response = http.request(request)
puts response.read_body
```

```java Create a ticket workflow
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.moveworks.ai/configurations/v1alpha1/tool/ticket/workflows")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"display_name\": \"example-name\",\n  \"version\": {\n    \"change_description\": \"Create ticket workflow\"\n  },\n  \"connector_id\": \"<connector-uuid>\",\n  \"conditional_actions\": [\n    {\n      \"condition_dsl\": \"true\",\n      \"actions\": [\n        {\n          \"create_ticket_action\": {}\n        }\n      ]\n    }\n  ],\n  \"default_action\": {\n    \"actions\": [\n      {\n        \"create_ticket_action\": {}\n      }\n    ]\n  }\n}")
  .asString();
```

```php Create a ticket workflow
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.moveworks.ai/configurations/v1alpha1/tool/ticket/workflows', [
  'body' => '{
  "display_name": "example-name",
  "version": {
    "change_description": "Create ticket workflow"
  },
  "connector_id": "<connector-uuid>",
  "conditional_actions": [
    {
      "condition_dsl": "true",
      "actions": [
        {
          "create_ticket_action": {}
        }
      ]
    }
  ],
  "default_action": {
    "actions": [
      {
        "create_ticket_action": {}
      }
    ]
  }
}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

echo $response->getBody();
```

```csharp Create a ticket workflow
using RestSharp;

var client = new RestClient("https://api.moveworks.ai/configurations/v1alpha1/tool/ticket/workflows");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"display_name\": \"example-name\",\n  \"version\": {\n    \"change_description\": \"Create ticket workflow\"\n  },\n  \"connector_id\": \"<connector-uuid>\",\n  \"conditional_actions\": [\n    {\n      \"condition_dsl\": \"true\",\n      \"actions\": [\n        {\n          \"create_ticket_action\": {}\n        }\n      ]\n    }\n  ],\n  \"default_action\": {\n    \"actions\": [\n      {\n        \"create_ticket_action\": {}\n      }\n    ]\n  }\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Create a ticket workflow
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = [
  "display_name": "example-name",
  "version": ["change_description": "Create ticket workflow"],
  "connector_id": "<connector-uuid>",
  "conditional_actions": [
    [
      "condition_dsl": "true",
      "actions": [["create_ticket_action": []]]
    ]
  ],
  "default_action": ["actions": [["create_ticket_action": []]]]
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.moveworks.ai/configurations/v1alpha1/tool/ticket/workflows")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```