# PUT /api/contracts/{id}

Update contract

Updates an existing contract's terms, fees, and configuration.

**Operation ID:** `contractsUpdate`

## Authorization

Requires: Customers.Contracts, Customers.Contracts.Update, merchant scope.

Required permissions:
- `Customers.Contracts`
- `Customers.Contracts.Update`

## Parameters

| Name | In | Required | Type | Description |
| --- | --- | --- | --- | --- |
| id | path | yes | string(uuid) |  |
| suppressNulls | query | no | boolean | If true, omit properties with null values. |

## Request Body

**Content type:** `application/json`

Schema: `ContractUpdateDto`

Properties:
- `customerId` (string(uuid)) required: Gets or sets the identifier of the customer associated with this contract.
- `customFields` (array<ContractCustomField>): Gets or sets the merchant-defined custom field values to carry on this contract. Identify a  field by the `Name` of one of the merchant's custom-field definitions; the value is  stamped onto each transaction the contract bills. Leave the collection out to keep whatever  the contract already carries; send an empty collection to clear them.
- `perBillInvoice` (object) required: Gets or sets the per-bill invoice configuration, controlling how individual invoices are generated.
- `thresholds` (object): Gets or sets the threshold rules that govern contract execution limits (e.g., maximum amount, retry caps).
- `aggregates` (object): Gets or sets aggregate billing totals and counters tracked across contract executions.
- `schedule` (object): Gets or sets the recurrence schedule that determines when the contract is executed.
- `payMethod` (object) required: Gets or sets the payment method configuration used when the contract is billed. Conditional: When PayMethod is not null.
- `emailNotifications` (object): Gets or sets the email notification settings for contract billing events. Conditional: When EmailNotifications is not null.
- `isActive` (boolean): Gets or sets a value indicating whether this contract is active and eligible for execution.
- `planId` (string(uuid)): Gets or sets the reusable plan this contract subscribes to for its price. Leave it empty to  price the contract inline through `perBillInvoice`. When a plan is supplied, the  per-bill amounts on this payload are ignored and replaced with the plan's current price.
- `trialEndDate` (string(date-time)): Gets or sets the calendar day the contract's trial ends, in UTC, or null for no trial. Nothing  is charged before this day; the first charge falls on it, or on the schedule's first  occurrence after it, at the full contract amount. On create it must be after the start date  and not in the past. Left empty on create against a plan that carries trial days, it is  seeded from the plan; the value stays editable per contract afterwards.
- `description` (string): Gets or sets an optional description providing additional context for the contract.
- `name` (string) required: Gets or sets the display name of the contract.
- `notes` (array<EntityNote>): Gets or sets the collection of notes attached to this contract.
- `tags` (array<EntityTag>): Gets or sets the collection of tags used to categorize or label this contract.
- `concurrencyStamp` (string): Gets or sets the concurrency stamp used for optimistic concurrency control.

**Content type:** `text/json`

Schema: `ContractUpdateDto`

Properties:
- `customerId` (string(uuid)) required: Gets or sets the identifier of the customer associated with this contract.
- `customFields` (array<ContractCustomField>): Gets or sets the merchant-defined custom field values to carry on this contract. Identify a  field by the `Name` of one of the merchant's custom-field definitions; the value is  stamped onto each transaction the contract bills. Leave the collection out to keep whatever  the contract already carries; send an empty collection to clear them.
- `perBillInvoice` (object) required: Gets or sets the per-bill invoice configuration, controlling how individual invoices are generated.
- `thresholds` (object): Gets or sets the threshold rules that govern contract execution limits (e.g., maximum amount, retry caps).
- `aggregates` (object): Gets or sets aggregate billing totals and counters tracked across contract executions.
- `schedule` (object): Gets or sets the recurrence schedule that determines when the contract is executed.
- `payMethod` (object) required: Gets or sets the payment method configuration used when the contract is billed. Conditional: When PayMethod is not null.
- `emailNotifications` (object): Gets or sets the email notification settings for contract billing events. Conditional: When EmailNotifications is not null.
- `isActive` (boolean): Gets or sets a value indicating whether this contract is active and eligible for execution.
- `planId` (string(uuid)): Gets or sets the reusable plan this contract subscribes to for its price. Leave it empty to  price the contract inline through `perBillInvoice`. When a plan is supplied, the  per-bill amounts on this payload are ignored and replaced with the plan's current price.
- `trialEndDate` (string(date-time)): Gets or sets the calendar day the contract's trial ends, in UTC, or null for no trial. Nothing  is charged before this day; the first charge falls on it, or on the schedule's first  occurrence after it, at the full contract amount. On create it must be after the start date  and not in the past. Left empty on create against a plan that carries trial days, it is  seeded from the plan; the value stays editable per contract afterwards.
- `description` (string): Gets or sets an optional description providing additional context for the contract.
- `name` (string) required: Gets or sets the display name of the contract.
- `notes` (array<EntityNote>): Gets or sets the collection of notes attached to this contract.
- `tags` (array<EntityTag>): Gets or sets the collection of tags used to categorize or label this contract.
- `concurrencyStamp` (string): Gets or sets the concurrency stamp used for optimistic concurrency control.

**Content type:** `application/*+json`

Schema: `ContractUpdateDto`

Properties:
- `customerId` (string(uuid)) required: Gets or sets the identifier of the customer associated with this contract.
- `customFields` (array<ContractCustomField>): Gets or sets the merchant-defined custom field values to carry on this contract. Identify a  field by the `Name` of one of the merchant's custom-field definitions; the value is  stamped onto each transaction the contract bills. Leave the collection out to keep whatever  the contract already carries; send an empty collection to clear them.
- `perBillInvoice` (object) required: Gets or sets the per-bill invoice configuration, controlling how individual invoices are generated.
- `thresholds` (object): Gets or sets the threshold rules that govern contract execution limits (e.g., maximum amount, retry caps).
- `aggregates` (object): Gets or sets aggregate billing totals and counters tracked across contract executions.
- `schedule` (object): Gets or sets the recurrence schedule that determines when the contract is executed.
- `payMethod` (object) required: Gets or sets the payment method configuration used when the contract is billed. Conditional: When PayMethod is not null.
- `emailNotifications` (object): Gets or sets the email notification settings for contract billing events. Conditional: When EmailNotifications is not null.
- `isActive` (boolean): Gets or sets a value indicating whether this contract is active and eligible for execution.
- `planId` (string(uuid)): Gets or sets the reusable plan this contract subscribes to for its price. Leave it empty to  price the contract inline through `perBillInvoice`. When a plan is supplied, the  per-bill amounts on this payload are ignored and replaced with the plan's current price.
- `trialEndDate` (string(date-time)): Gets or sets the calendar day the contract's trial ends, in UTC, or null for no trial. Nothing  is charged before this day; the first charge falls on it, or on the schedule's first  occurrence after it, at the full contract amount. On create it must be after the start date  and not in the past. Left empty on create against a plan that carries trial days, it is  seeded from the plan; the value stays editable per contract afterwards.
- `description` (string): Gets or sets an optional description providing additional context for the contract.
- `name` (string) required: Gets or sets the display name of the contract.
- `notes` (array<EntityNote>): Gets or sets the collection of notes attached to this contract.
- `tags` (array<EntityTag>): Gets or sets the collection of tags used to categorize or label this contract.
- `concurrencyStamp` (string): Gets or sets the concurrency stamp used for optimistic concurrency control.

## Responses

### 200

OK

**Content type:** `application/json`

Schema: `ContractDto`

Properties:
- `extraProperties` (object)
- `id` (string(uuid))
- `creationTime` (string(date-time)): The date and time when this entity was created.
- `creatorId` (string(uuid)): The ID of the user who created this entity.
- `lastModificationTime` (string(date-time)): The date and time when this entity was last modified.
- `lastModifierId` (string(uuid)): The ID of the user who last modified this entity.
- `isDeleted` (boolean): Indicates whether this entity has been deleted.
- `deleterId` (string(uuid)): The ID of the user who deleted this entity, if it is deleted.
- `deletionTime` (string(date-time)): The date and time when this entity was deleted, if it is deleted.
- `customerId` (string(uuid)): Gets or sets the identifier of the customer who owns this contract.
- `customerName` (string): Gets or sets the display name of the associated customer, used for grid rendering.
- `legacyNumber` (integer(int64)): Gets or sets the contract's legacy numeric key, the integer identifier the v1 API resolves  contracts by. Server-owned: stamped at create and ignored on every inbound payload. Null on  contracts created before the field existed and not yet back-filled by the v1 data migration.
- `totalExecutions` (integer(int32)): Gets or sets the total number of billing executions performed for this contract.
- `successfulExecutions` (integer(int32)): Gets or sets the number of successful billing executions.
- `failedExecutions` (integer(int32)): Gets or sets the number of failed billing executions.
- `totalAmountBilled` (number(double)): Gets or sets the cumulative amount billed across all executions.
- `amountPerAttempt` (number(double)): Gets or sets the amount charged per billing attempt.
- `paymentMethodType` (object): Gets or sets the type of payment method used by this contract.
- `customFields` (array<ContractCustomField>): Gets or sets the merchant-defined custom field values carried on this contract, or null when  it carries none. Null and an empty collection are different answers: null means the contract  has never had custom fields set, empty means they were explicitly cleared.
- `perBillInvoice` (object): Gets or sets the per-bill invoice configuration for this contract.
- `thresholds` (object): Gets or sets the threshold rules governing contract execution limits.
- `aggregates` (object): Gets or sets aggregate billing totals tracked across contract executions.
- `schedule` (object): Gets or sets the recurrence schedule for contract execution.
- `payMethod` (object): Gets or sets the payment method configuration used when the contract is billed.
- `emailNotifications` (object): Gets or sets the email notification settings for contract billing events.
- `isActive` (boolean): Gets or sets a value indicating whether this contract is active and eligible for execution.
- `planId` (string(uuid)): Gets or sets the reusable plan this contract subscribes to for its price, or null when the  contract carries its own inline amount. When set, the recurring billing engine resolves the  amount from the plan at charge time and the per-bill amounts on this contract are a snapshot  of it.
- `trialEndDate` (string(date-time)): Gets or sets the calendar day the contract's trial ends, in UTC, or null when the contract has  no trial. While this day is still ahead the contract is active but not charged; the first  charge falls on it, or on the schedule's first occurrence after it, at the full amount.
- `description` (string): Gets or sets an optional description providing additional context for the contract.
- `deactivationReason` (object): Gets or sets the reason this contract was deactivated, or null when the contract is active  or was never deactivated. Server-owned: set by the recurring billing engine when a threshold  or schedule ends the contract, by the self-service cancellation flow when the payer cancels,  and cleared back to null when the contract is reactivated. Read-only over the API; an  inbound payload can never set it.
- `pauseReason` (string): Gets or sets why an operator paused this contract, or null when it is not paused. Present  only while `deactivationReason` is `Paused`. Server-owned: written by the  pause operation and cleared by every resume; read-only over the API.
- `pausedDate` (string(date-time)): Gets or sets when the contract was paused, in UTC, or null when it is not paused. Server-owned  and read-only over the API.
- `expectedResumeDate` (string(date-time)): Gets or sets the UTC calendar day on which the daily billing run resumes the contract on its  own, or null for a pause only an operator ends. Server-owned and read-only over the API; set  it through the pause operation.
- `convenienceFeeWaived` (boolean): Gets or sets whether the cardholder enrolled in this contract on terms that disclosed no  convenience fee, so no scheduled charge under it carries one. Null or false means each charge's  fee follows the merchant's convenience-fee configuration. Server-owned: recorded when the  contract is created from a hosted payment page that carried no fee, and read-only over the API.
- `name` (string): Gets or sets the display name of the contract.
- `notes` (array<EntityNote>): Gets or sets the collection of notes attached to this contract.
- `tags` (array<EntityTag>): Gets or sets the collection of tags used to categorize this contract.
- `concurrencyStamp` (string): Gets or sets the concurrency stamp used for optimistic concurrency control.
- `entityVersion` (integer(int32)): Gets the entity version, incremented on each modification for optimistic concurrency.

### 403

Forbidden

**Content type:** `application/json`

Schema: `RemoteServiceErrorResponse`

Properties:
- `error` (RemoteServiceErrorInfo)

### 401

Unauthorized

**Content type:** `application/json`

Schema: `RemoteServiceErrorResponse`

Properties:
- `error` (RemoteServiceErrorInfo)

### 400

Bad Request

**Content type:** `application/json`

Schema: `RemoteServiceErrorResponse`

Properties:
- `error` (RemoteServiceErrorInfo)

### 404

Not Found

**Content type:** `application/json`

Schema: `RemoteServiceErrorResponse`

Properties:
- `error` (RemoteServiceErrorInfo)

### 501

Not Implemented

**Content type:** `application/json`

Schema: `RemoteServiceErrorResponse`

Properties:
- `error` (RemoteServiceErrorInfo)

### 500

Internal Server Error

**Content type:** `application/json`

Schema: `RemoteServiceErrorResponse`

Properties:
- `error` (RemoteServiceErrorInfo)

### default

The request failed. The body carries the standard error envelope: a machine-readable `error.code`, a human-readable `error.message`, and `error.validationErrors` when the failure was a validation rejection. See the error-code reference in this document's description for the values `error.code` can take.

**Content type:** `application/json`

Schema: `RemoteServiceErrorResponse`

Properties:
- `error` (RemoteServiceErrorInfo)

### 429

The request was refused because a rate limit was exceeded, or because something a later retry can clear stopped it. A rate limit refusal carries an `application/problem+json` body: wait at least the interval `Retry-After` names before retrying, then back off. Limits are tuned per deployment, so read the allowance from the response headers rather than assuming a fixed ceiling. Any other refusal carries the standard error envelope as `application/json`, and its `error.code` names the cause.

**Content type:** `application/problem+json`

Schema: `RateLimitProblemDetails`

Properties:
- `type` (string) required: The problem type identifier. Always the same value: the failure is the status code itself,  so there is no sub-type for a caller to branch on.
- `title` (string) required: A short, human-readable summary of the problem type.
- `status` (integer(int32)) required: The HTTP status code, repeated in the body as the problem-details format defines.
- `detail` (string) required: A human-readable explanation of this occurrence of the problem.
- `retryAfterSeconds` (integer(int32)) required: How long to wait before retrying, in whole seconds, carrying the same figure as the  `Retry-After` header. Always at least one: a value of zero would invite an immediate  retry that is certain to be rejected again.

**Content type:** `application/json`

Schema: `RemoteServiceErrorResponse`

Properties:
- `error` (RemoteServiceErrorInfo)

## Example request

Every block below sends the same request. Replace {{BASE_URL}} with the address of the API you are calling and {{API_KEY}} with your own key.

The request body is a ContractUpdateDto. See the Request body section below for its fields.

### cURL

```bash
curl -X PUT "{{BASE_URL}}/api/contracts/{id}" \
  -H "api-key: {{API_KEY}}" \
  -H "Content-Type: application/json" \
  -d '{
  "customerId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
  "perBillInvoice": {},
  "payMethod": {},
  "name": ""
}'
```

### PowerShell

```powershell
$headers = @{
    'api-key' = '{{API_KEY}}'
}

$body = @'
{
  "customerId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
  "perBillInvoice": {},
  "payMethod": {},
  "name": ""
}
'@

$response = Invoke-RestMethod -Method PUT -Uri '{{BASE_URL}}/api/contracts/{id}' `
    -Headers $headers -ContentType 'application/json' -Body $body
```

### TypeScript (SDK)

```bash
npm install @winkpg/winkpg-api
```

```typescript
import { Configuration, ContractsApi } from '@winkpg/winkpg-api';

const api = new ContractsApi(new Configuration({
  basePath: '{{BASE_URL}}',
  apiKey: '{{API_KEY}}',
}));

const { data } = await api.contractsUpdate("3fa85f64-5717-4562-b3fc-2c963f66afa6", {
  "customerId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
  "perBillInvoice": {},
  "payMethod": {},
  "name": ""
});
```

### TypeScript (raw HTTP)

```typescript
const response = await fetch('{{BASE_URL}}/api/contracts/{id}', {
  method: 'PUT',
  headers: {
    "api-key": "{{API_KEY}}",
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    "customerId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
    "perBillInvoice": {},
    "payMethod": {},
    "name": ""
  }),
});

const data = await response.json();
```

### C# (SDK)

```bash
dotnet add package WinkPg.Api.Client
```

```csharp
using WinkPg.Api.Client.Api;
using WinkPg.Api.Client.Client;
using System.Text.Json;

var config = new Configuration { BasePath = "{{BASE_URL}}" };
config.AddApiKey("api-key", "{{API_KEY}}");

var api = new ContractsApi(config);
var body = JsonSerializer.Deserialize<ContractUpdateDto>("""
    {
      "customerId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
      "perBillInvoice": {},
      "payMethod": {},
      "name": ""
    }
    """);

var result = await api.ContractsUpdateAsync(Guid.Parse("3fa85f64-5717-4562-b3fc-2c963f66afa6"), body);
```

### C# (raw HTTP)

```csharp
using System.Text;

using var http = new HttpClient { BaseAddress = new Uri("{{BASE_URL}}") };

var request = new HttpRequestMessage(new HttpMethod("PUT"), "/api/contracts/{id}");
request.Headers.Add("api-key", "{{API_KEY}}");

request.Content = new StringContent("""
    {
      "customerId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
      "perBillInvoice": {},
      "payMethod": {},
      "name": ""
    }
    """, Encoding.UTF8, "application/json");

var response = await http.SendAsync(request);
response.EnsureSuccessStatusCode();
var json = await response.Content.ReadAsStringAsync();
```

### Python (SDK)

```bash
pip install winkpg-api
```

```python
import winkpg_api

configuration = winkpg_api.Configuration(host="{{BASE_URL}}")
configuration.api_key["ApiKey"] = "{{API_KEY}}"

with winkpg_api.ApiClient(configuration) as client:
    api = winkpg_api.ContractsApi(client)
    body = winkpg_api.ContractUpdateDto.from_dict({
      "customerId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
      "perBillInvoice": {},
      "payMethod": {},
      "name": ""
    })
    result = api.contracts_update("3fa85f64-5717-4562-b3fc-2c963f66afa6", body)
```

### Python (raw HTTP)

```bash
pip install requests
```

```python
import requests

headers = {
    "api-key": "{{API_KEY}}",
    "Content-Type": "application/json",
}

body = {
  "customerId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
  "perBillInvoice": {},
  "payMethod": {},
  "name": ""
}

response = requests.request(
    "PUT",
    "{{BASE_URL}}/api/contracts/{id}",
    headers=headers,
    json=body,
)
response.raise_for_status()
data = response.json()
```

## See also

- [All documentation](https://devportal-simpay-sbx.winkpg.io/llms.txt): the machine-readable index of every public page on this site.
