> You are reading the Docusign Developer Documentation. For clean Markdown of any page, append .md to the page URL.
>
> Documentation indexes by section:
> - APIs and SDKs: https://docusign.docs.buildwithfern.com/docs/llms.txt
> - Platform 101: https://docusign.docs.buildwithfern.com/platform/llms.txt
> - Extension Apps: https://docusign.docs.buildwithfern.com/extension-apps/llms.txt
> - Docusign CLI: https://docusign.docs.buildwithfern.com/docusign-cli/llms.txt
>
> Authentication (OAuth, JWT Grant, M2M): https://docusign.docs.buildwithfern.com/platform/auth
> Webhooks and Connect: https://docusign.docs.buildwithfern.com/platform/webhooks
>
> OpenAPI specifications: https://docusign.docs.buildwithfern.com/openapi.json
> MCP server: https://docusign.docs.buildwithfern.com/_mcp/server

# How to activate an elastic template

> This topic shows how to activate a new elastic template for an account by using the Click API.

This topic describes how to use [Docusign Click](https://www.docusign.com/products/click) to activate a new elastic template that you have already created. By default, new elastic templates are inactive. You must activate your elastic template before you can use it.

> **Note**
>
> Run this code example from our [Quickstart](/docs/esign-rest-api/quickstart) or launcher projects: [Bash](https://github.com/docusign/code-examples-bash), [C#](https://github.com/docusign/code-examples-csharp), [Java](https://github.com/docusign/code-examples-java), [Node.js](https://github.com/docusign/code-examples-node), [PHP](https://github.com/docusign/code-examples-php), [PowerShell](https://github.com/docusign/code-examples-powershell), [Python](https://github.com/docusign/code-examples-python), or [Ruby](https://github.com/docusign/code-examples-ruby).

## Required data

Running the code in this how-to requires this data:

| Data element      | Description                                                                                                                                                                                                                                                                                                             |
| ----------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| \{API_ACCOUNT_ID} | A [GUID](http://guid.one/) value that identifies your account. This value is automatically generated by Docusign for any account you create. Copy the value from the **API Account ID** field on the [Apps and Keys](https://admindemo.docusign.com/authenticate?goTo=appsAndKeys) page.                                |
| \{BASE_PATH}      | A string value that forms the root of the URL required to make API calls. The base path value in the example code is set to target the developer environment at https\://\<domain>/clickapi Where \<domain> is demo.docusign.net for the developer environment and is the result of the GetUserInfo call in production. |
| \{CLICKWRAP_ID}   | A [GUID](http://guid.one/) value that identifies an individual elastic template. You can obtain this value by following the steps in [How to get a list of elastic templates](/docs/click-api/how-to/retrieve-elastic-templates).                                                                                       |
| \{VERSION_NUMBER} | This value specifies the version of the elastic template to activate. To activate a new elastic template, use the `versionNumber` value `1`.                                                                                                                                                                            |

## Step 1. Obtain your OAuth token

To make the API call shown in this how-to, you need a valid OAuth access token. Docusign supports access tokens for three different recommended OAuth grant types: Public Authorization Code Grant, Confidential Authorization Code Grant, and JSON Web Token (JWT) Grant. Choose the OAuth grant type appropriate for your scenario.

> **Note**
>
> See [Authentication](/docs/click-api/click101/auth) for guidance on your options to get an OAuth token.

![Three icons that represent the three methods a user can use to obtain an OAuth token: JSON Web Token (JWT), Public Authorization Code Grant (ACG), and Confidential Authorization Code grant](/_fern-files/_img/64f473773042ee439449a096bf7673292b1585b86a4ccc55f82ba0dda41f61a1.webp)

## Step 2. Construct your API headers

After you have a valid OAuth access token, you are ready to construct the API headers that you will pass to the API call. Construct your headers like this, but make sure to substitute your valid OAuth access token for \{ACCESS_TOKEN}.

**`Bash`**

```bash title="Bash"
declare -a Headers=('--header' "Authorization: Bearer ${ACCESS_TOKEN}"
    '--header' "Content-Type: application/json"
    '--header' "Accept: application/json")
```

**`C#`**

```csharp title="C#"
var docuSignClient = new DocuSignClient(basePath);
docuSignClient.Configuration.DefaultHeader.Add("Authorization", "Bearer " + accessToken);
var clickAccountApi = new AccountsApi(docuSignClient);
```

**`Java`**

```java title="Java"
ApiClient apiClient = new ApiClient(basePath);
apiClient.addDefaultHeader(HttpHeaders.AUTHORIZATION, BEARER_AUTHENTICATION + userAccessToken);
apiClient.addAuthorization("docusignAccessCode", new OAuth());
return apiClient;
```

**`Node.js`**

```javascript title="Node.js"
const dsApiClient = new docusignClick.ApiClient();
dsApiClient.setBasePath(args.basePath);
dsApiClient.addDefaultHeader('Authorization', 'Bearer ' + args.accessToken);
```

**`PHP`**

```php title="PHP"
$config = new Configuration();
$config->setHost('https://demo.docusign.net/clickapi');
$config->addDefaultHeader('Authorization', 'Bearer ' . $args['ds_access_token']);
$this->apiClient = new ApiClient($config);
```

**`PowerShell`**

```text title="PowerShell"
$headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]"
$headers.add("Authorization", "Bearer $accessToken")
$headers.add("Accept", "application/json")
$headers.add("Content-Type", "application/json")
```

**`Python`**

```python title="Python"
api_client = create_click_api_client(
    access_token=args["access_token"]
)
```

**`Ruby`**

```ruby title="Ruby"
configuration = DocuSign_Click::Configuration.new
configuration.host = args[:base_path]

api_client = DocuSign_Click::ApiClient.new configuration
api_client.set_default_header('Authorization', "Bearer #{args[:access_token]}")
```

## Step 3. Construct the request body

Next, create the request body. Set the value of the `status` property to `active`. This is the only value you need to specify in the request body. Example:

```text
{
   "status": "active"
}
```

**`Bash`**

```bash title="Bash"
printf \
    '{
        "status" : "active"
    }' >$request_data
```

**`C#`**

```csharp title="C#"
var clickwrapRequest = BuildUpdateClickwrapVersionRequest();
        public static ClickwrapRequest BuildUpdateClickwrapVersionRequest()
        {
var clickwrapRequest = new ClickwrapRequest
{
    Status = "active",
};

return clickwrapRequest;
        }
```

**`Java`**

```java title="Java"
ClickwrapRequest clickwrapRequest = new ClickwrapRequest().status(ClickwrapHelper.STATUS_ACTIVE);
```

**`Node.js`**

```javascript title="Node.js"
const clickwrapRequest = docusignClick.ClickwrapRequest.constructFromObject({
  status: 'active',
});
```

**`PHP`**

```php title="PHP"
$clickwrap_request = new ClickwrapRequest(['status' => 'active']);
```

**`PowerShell`**

```text title="PowerShell"
$body = @"
{
"status" : "active"
}
"@
```

**`Python`**

```python title="Python"
clickwrap_request = ClickwrapRequest(status="active")
```

**`Ruby`**

```ruby title="Ruby"
clickwrap_request = DocuSign_Click::ClickwrapRequest.new(status: 'active')
```

## Step 4. Call the Click API

Now that you have constructed your API headers and request body, make a PUT request to the [ClickWraps:updateClickwrapVersion](/docs/click-api/reference/accounts/clickwraps/updateclickwrapversion) method to activate the elastic template for your account. Here’s how you make the call, but make sure to substitute your API Account ID for \{ACCOUNT_ID} and the elastic template ID for \{CLICKWRAP_ID}.

**Note:** For compatibility with previous versions of the Click API, elastic templates use clickwrap endpoints.

> **Note**
>
> View the source code for this how-to on GitHub: [Bash](https://github.com/docusign/code-examples-bash/blob/master/examples/Click/eg002ActivateClickwrap.sh), [C#](https://github.com/docusign/code-examples-csharp/blob/master/launcher-csharp/Click/Examples/ActivateClickwrap.cs), [Java](https://github.com/docusign/code-examples-java/blob/master/src/main/java/com/docusign/controller/click/services/ActivateClickwrapService.java), [Node.js](https://github.com/docusign/code-examples-node/blob/master/lib/click/examples/activateClickwrap.js), [PHP](https://github.com/docusign/code-examples-php/blob/master/src/Services/Examples/Click/ActivateClickwrapService.php), [PowerShell](https://github.com/docusign/code-examples-powershell/blob/master/examples/Click/eg002ActivateClickwrap.ps1),  [Python](https://github.com/docusign/code-examples-python/blob/master/app/click/examples/eg002_activate_clickwrap.py), [Ruby](https://github.com/docusign/code-examples-ruby/blob/master/app/services/clickwrap/eg002_activate_clickwrap_service.rb).

**`Bash`**

```bash title="Bash"
curl --request PUT https://demo.docusign.net/clickapi/v1/accounts/${account_id}/clickwraps/${clickwrap_id}/versions/${VersionNumber} \
    "${Headers[@]}" \
    --data-binary @${request_data} \
    --output ${response}
```

**`C#`**

```csharp title="C#"
var response = clickAccountApi.UpdateClickwrapVersionWithHttpInfo(accountId, clickwrapId, clickwrapVersion, clickwrapRequest);

response.Headers.TryGetValue("X-RateLimit-Remaining", out string remaining);
response.Headers.TryGetValue("X-RateLimit-Reset", out string reset);

if (reset != null && remaining != null)
{
    DateTime resetDate = DateTimeOffset.FromUnixTimeSeconds(long.Parse(reset)).UtcDateTime;
    Console.WriteLine("API calls remaining: " + remaining);
    Console.WriteLine("Next Reset: " + resetDate);
}

return response.Data;
```

**`Java`**

```java title="Java"
ApiResponse<ClickwrapVersionSummaryResponse> response = accountsApi.updateClickwrapVersionWithHttpInfo(
        accountId,
        clickwrapId,
        clickwrapVersionNumber,
        clickwrapRequest);

Map<String, List<String>> headers = response.getHeaders();
List<String> remaining = headers.get("X-RateLimit-Remaining");
List<String> reset = headers.get("X-RateLimit-Reset");

if (remaining != null & reset != null) {
    Instant resetInstant = Instant.ofEpochSecond(Long.parseLong(reset.get(0)));
    System.out.println("API calls remaining: " + remaining);
    System.out.println("Next Reset: " + resetInstant);
}

return response.getData();
```

**`Node.js`**

```javascript title="Node.js"
const result = await new Promise((resolve, reject) => {
    accountApi.updateClickwrapVersion(
  args.accountId,
  args.clickwrapId,
  args.clickwrapVersionNumber,
  { clickwrapRequest }, (err, data, response) => {
      if (err) return reject(err);
      resolve({ data, response });
    });
  });

  const headers = result.response.headers;
  const remaining = headers['x-ratelimit-remaining'];
  const reset = headers['x-ratelimit-reset'];

  if (remaining && reset) {
    const resetInstant = new Date(Number(reset) * 1000);
    console.log(`API calls remaining: ${remaining}`);
    console.log(`Next Reset: ${resetInstant.toISOString()}`);
  }
```

**`PHP`**

```php title="PHP"
$accounts_api = $clientService->accountsApi();
$response = $accounts_api->updateClickwrapVersionWithHttpInfo(
    $args['account_id'],
    $args['clickwrap_id'],
    $args['version_number'],
    $clickwrap_request
);

$remaining = $response[2]['X-RateLimit-Remaining'] ?? null;
$reset = $response[2]['X-RateLimit-Reset'] ?? null;

if ($remaining !== null && $reset !== null) {
    $resetInstant = (new DateTime())->setTimestamp((int)$reset);
    error_log("API calls remaining: $remaining");
    error_log("Next Reset: " . $resetInstant->format(\DateTime::ATOM));
}
```

**`PowerShell`**

```text title="PowerShell"
$uri = "https://demo.docusign.net/clickapi/v1/accounts/$APIAccountId/clickwraps/$ClickWrapId/versions/$VersionNumber"
$result = Invoke-WebRequest -headers $headers -Uri $uri -UseBasicParsing -Method PUT -Body $body
Write-Output "Response: "
$result.Content
```

**`Python`**

```python title="Python"
accounts_api = AccountsApi(api_client)
(response, status, headers) = accounts_api.update_clickwrap_version_with_http_info(
    account_id=args["account_id"],
    clickwrap_id=clickwrap["clickwrap_id"],
    version_id=clickwrap["version_number"],
    clickwrap_request=clickwrap_request,
)

remaining = headers.get("X-RateLimit-Remaining")
reset = headers.get("X-RateLimit-Reset")

if remaining is not None and reset is not None:
    reset_date = dt.fromtimestamp(int(reset), tz=timezone.utc)
    print(f"API calls remaining: {remaining}")
    print(f"Next Reset: {reset_date}")
```

**`Ruby`**

```ruby title="Ruby"
accounts_api = DocuSign_Click::AccountsApi.new(api_client)
results, _status, headers = accounts_api.update_clickwrap_version_with_http_info(
  args[:account_id],
  args[:clickwrap_id],
  1,
  clickwrap_request
)

remaining = headers['X-RateLimit-Remaining']
reset = headers['X-RateLimit-Reset']

if remaining && reset
  reset_date = Time.at(reset.to_i).utc
  puts "API calls remaining: #{remaining}"
  puts "Next Reset: #{reset_date}"
end
```

## Expected response

If you run this code example from our Quickstart or launcher projects, you should see a JSON response similar to the code shown.

**`Sample response`**

```json title="Sample response"
{
  "accountId": "a56df5fc-xxxx-xxxx-xxxx-f64dc8ab421e",
  "clickwrapId": "66a85a21-xxxx-xxxx-xxxx-6f9dd48c8483",
  "clickwrapName": "Terms of Service",
  "versionId": "f19f1935-xxxx-xxxx-xxxx-fe8d93d78815",
  "versionNumber": 1,
  "status": "active",
  "createdTime": "2020-08-03T18:20:35.7848896Z",
  "lastModified": "2020-08-04T18:06:23.4715478Z",
  "lastModifiedBy": "c1c4ca80-xxxx-xxxx-xxxx-32a3a9b13925",
  "requireReacceptance": true,
  "ownerUserId": "c1c4ca80-xxxx-xxxx-xxxx-32a3a9b13925"
}
```

## Next steps

* Run this code example from our [Quickstart](/docs/esign-rest-api/quickstart) or launcher projects:    [Bash](https://github.com/docusign/code-examples-bash), [C#](https://github.com/docusign/code-examples-csharp), [Java](https://github.com/docusign/code-examples-java), [Node.js](https://github.com/docusign/code-examples-node), [PHP](https://github.com/docusign/code-examples-php), [PowerShell](https://github.com/docusign/code-examples-powershell), [Python](https://github.com/docusign/code-examples-python), or [Ruby](https://github.com/docusign/code-examples-ruby).
* See how to [Go-Live](/docs/click-api/go-live) with a completed app and find the base path for API calls in the production environment.