> For a complete page index, fetch https://developer.close.com/llms.txt

# Update a Sequence

PUT https://api.close.com/api/v1/sequence/{id}/
Content-Type: application/json

**Note**: If you include `steps` in the payload and exclude some of the existing steps in your sequence, it will remove those steps from the sequence entirely.

Reference: https://developer.close.com/api/resources/sequences/update

## Authentication

- `Authorization` header (basic auth, required) — Use your API key as the username and leave the password empty.
- `Authorization` header (bearer token, required)

## Request

### Path parameters

- `id` (string, required)

### Body (application/json)

- `any`

## Response

### 200

Successful response

## Examples

**Request**

```json
{
  "name": "My New Sequence Name",
  "steps": [
    {
      "id": "seqstep_3fdjsr0thQshwVXo8rWG47"
    },
    {
      "id": "seqstep_0yMcp2AXxJh27sWsNpH0f1"
    },
    {
      "id": "seqstep_kjsd324toiweuroo812394"
    }
  ]
}
```

**Response**

```json
{
  "created_by_id": "user_N6KhMpzHRCYQHdn4gRNIFNN5JExnsrprKA6ekxM63XA",
  "date_created": "2022-03-10T14:31:45.512611",
  "date_updated": "2022-03-10T14:31:45.512615",
  "id": "seq_51kUuBR322o1B7vb2HvzSz",
  "name": "My New Sequence Name",
  "organization_id": "orga_RbREgmiiwcr1w2b4cOnCMQaQPSIFxMqAD2Dh243uxcH",
  "schedule": null,
  "status": "active",
  "steps": [
    {
      "created_by_id": "user_N6KhMpzHRCYQHdn4gRNIFNN5JExnsrprKA6ekxM63XA",
      "date_created": "2022-03-10T14:31:45.515197",
      "date_updated": "2022-03-10T14:31:45.515200",
      "delay": 0,
      "email_template_id": null,
      "id": "seqstep_3fdjsr0thQshwVXo8rWG47",
      "required": true,
      "step_allowed_delay": null,
      "step_type": "call",
      "threading": null,
      "updated_by_id": "user_N6KhMpzHRCYQHdn4gRNIFNN5JExnsrprKA6ekxM63XA"
    },
    {
      "created_by_id": "user_N6KhMpzHRCYQHdn4gRNIFNN5JExnsrprKA6ekxM63XA",
      "date_created": "2022-03-10T14:31:45.516521",
      "date_updated": "2022-03-10T14:31:45.516524",
      "delay": 86400,
      "email_template_id": "tmpl_VRIpo4I8JnTGANQsPv77kZvzAhbxbheWYPIRR3hKusu",
      "id": "seqstep_0yMcp2AXxJh27sWsNpH0f1",
      "required": true,
      "step_allowed_delay": null,
      "step_type": "email",
      "threading": "old_thread",
      "updated_by_id": "user_N6KhMpzHRCYQHdn4gRNIFNN5JExnsrprKA6ekxM63XA"
    },
    {
      "created_by_id": "user_N6KhMpzHRCYQHdn4gRNIFNN5JExnsrprKA6ekxM63XA",
      "date_created": "2022-03-10T14:31:45.517156",
      "date_updated": "2022-03-10T14:31:45.517159",
      "delay": 259200,
      "email_template_id": "tmpl_VRIpo4I8JnTGANQsPv77kZvzAhbxbheWYPIRR3hKusu",
      "id": "seqstep_kjsd324toiweuroo812394",
      "required": true,
      "step_allowed_delay": null,
      "step_type": "email",
      "threading": "old_thread",
      "updated_by_id": "user_N6KhMpzHRCYQHdn4gRNIFNN5JExnsrprKA6ekxM63XA"
    }
  ],
  "subscription_counts_by_status": {
    "active": 10,
    "error": 0,
    "finished": 5,
    "goal": 15,
    "paused": 2
  },
  "timezone": "America/Los_Angeles",
  "updated_by_id": "user_N6KhMpzHRCYQHdn4gRNIFNN5JExnsrprKA6ekxM63XA"
}
```

**SDK Code**

```python
import requests

url = "https://api.close.com/api/v1/sequence/:id/"

payload = {
    "name": "My New Sequence Name",
    "steps": [{ "id": "seqstep_3fdjsr0thQshwVXo8rWG47" }, { "id": "seqstep_0yMcp2AXxJh27sWsNpH0f1" }, { "id": "seqstep_kjsd324toiweuroo812394" }]
}
headers = {
    "Content-Type": "application/json"
}

response = requests.put(url, json=payload, headers=headers, auth=("<CLOSE_API_KEY>", ""))

print(response.json())
```

```javascript
const url = 'https://api.close.com/api/v1/sequence/:id/';
const credentials = btoa("<CLOSE_API_KEY>:");

const options = {
  method: 'PUT',
  headers: {Authorization: `Basic ${credentials}`, 'Content-Type': 'application/json'},
  body: '{"name":"My New Sequence Name","steps":[{"id":"seqstep_3fdjsr0thQshwVXo8rWG47"},{"id":"seqstep_0yMcp2AXxJh27sWsNpH0f1"},{"id":"seqstep_kjsd324toiweuroo812394"}]}'
};

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

```go
package main

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

func main() {

	url := "https://api.close.com/api/v1/sequence/:id/"

	payload := strings.NewReader("{\n  \"name\": \"My New Sequence Name\",\n  \"steps\": [\n    {\n      \"id\": \"seqstep_3fdjsr0thQshwVXo8rWG47\"\n    },\n    {\n      \"id\": \"seqstep_0yMcp2AXxJh27sWsNpH0f1\"\n    },\n    {\n      \"id\": \"seqstep_kjsd324toiweuroo812394\"\n    }\n  ]\n}")

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

	req.SetBasicAuth("<CLOSE_API_KEY>", "")
	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
require 'uri'
require 'net/http'

url = URI("https://api.close.com/api/v1/sequence/:id/")

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

request = Net::HTTP::Put.new(url)
request.basic_auth("<CLOSE_API_KEY>", "")
request["Content-Type"] = 'application/json'
request.body = "{\n  \"name\": \"My New Sequence Name\",\n  \"steps\": [\n    {\n      \"id\": \"seqstep_3fdjsr0thQshwVXo8rWG47\"\n    },\n    {\n      \"id\": \"seqstep_0yMcp2AXxJh27sWsNpH0f1\"\n    },\n    {\n      \"id\": \"seqstep_kjsd324toiweuroo812394\"\n    }\n  ]\n}"

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

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.put("https://api.close.com/api/v1/sequence/:id/")
  .basicAuth("<CLOSE_API_KEY>", "")
  .header("Content-Type", "application/json")
  .body("{\n  \"name\": \"My New Sequence Name\",\n  \"steps\": [\n    {\n      \"id\": \"seqstep_3fdjsr0thQshwVXo8rWG47\"\n    },\n    {\n      \"id\": \"seqstep_0yMcp2AXxJh27sWsNpH0f1\"\n    },\n    {\n      \"id\": \"seqstep_kjsd324toiweuroo812394\"\n    }\n  ]\n}")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('PUT', 'https://api.close.com/api/v1/sequence/:id/', [
  'body' => '{
  "name": "My New Sequence Name",
  "steps": [
    {
      "id": "seqstep_3fdjsr0thQshwVXo8rWG47"
    },
    {
      "id": "seqstep_0yMcp2AXxJh27sWsNpH0f1"
    },
    {
      "id": "seqstep_kjsd324toiweuroo812394"
    }
  ]
}',
  'headers' => [
    'Content-Type' => 'application/json',
  ],
    'auth' => ['<CLOSE_API_KEY>', ''],
]);

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

```csharp
using RestSharp;
using RestSharp.Authenticators;

var client = new RestClient("https://api.close.com/api/v1/sequence/:id/");
client.Authenticator = new HttpBasicAuthenticator("<CLOSE_API_KEY>", "");
var request = new RestRequest(Method.PUT);

request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"name\": \"My New Sequence Name\",\n  \"steps\": [\n    {\n      \"id\": \"seqstep_3fdjsr0thQshwVXo8rWG47\"\n    },\n    {\n      \"id\": \"seqstep_0yMcp2AXxJh27sWsNpH0f1\"\n    },\n    {\n      \"id\": \"seqstep_kjsd324toiweuroo812394\"\n    }\n  ]\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```