client.UpdateKeyDetailsAsync()
Update Details
Updates a key's settings and returns its private details. Only the fields you send change. A key on an unlimited plan ignores changes to datasets, daily_limit and monthly_limit. Datasets set by your plan cannot be changed here: sending one with a different value returns a 400.
Endpoint
PUT /keys/{key}/details
See the API reference for this endpoint.
This operation needs a Management Key. Pass it as the second argument to new IdealPostcodesClient(apiKey, managementKey), or set ManagementKey in the options; the client sends it in the Authorization header. See setup.
Signature
Task<ApiKeyDetailsResponse> UpdateKeyDetailsAsync(string key, UpdateKeyDetailsBody body, CancellationToken cancellationToken = default)
Arguments
| Name | Type | Required | Description |
|---|---|---|---|
key | string | yes | API Key |
body | UpdateKeyDetailsBody | yes | The JSON request body. Fields under Request Body. |
cancellationToken | CancellationToken | no | Cancels the request. |
Query Parameters
None.
Request Body
Set these on the body argument. Each property is the name in PascalCase, such as PostTown for post_town; required fields are constructor arguments. A property left null is not sent.
| Name | Type | Required | Description |
|---|---|---|---|
name | string | no | A name for the key |
daily_limit | UpdateKeyDetailsDailyLimit | no | |
monthly_limit | UpdateKeyDetailsMonthlyLimit | no | |
individual_limit | UpdateKeyDetailsIndividualLimit | no | |
allowed_urls | IReadOnlyList<string> | no | A list of allowed URLs. An empty list disables the check. Up to 10 allowed. |
redact_days | long | no | Number of days to preserve personal data stored in your key usage history. Set to 0 to prevent personal data storage |
notifications | UpdateKeyDetailsNotifications | no | |
ip_forwarding | bool | no | Accept IP addresses forwarded in the IDPC-Source-IP header |
datasets | UpdateKeyDetailsDatasets | no | Datasets you can switch on or off for this key. Datasets set by your plan (paf, mr, nyb, ecad, ecaf) cannot be changed here: sending one with a different value returns a 400. |
Response
ApiKeyDetailsResponse. Fields are properties in PascalCase, such as response.Result; fields this SDK version does not know are kept in AdditionalProperties. See responses.
Errors
An HTTP error throws ApiException with the StatusCode, the API error Code and the raw Body. A success response whose body cannot be read throws UnserializableResponseException. Network failures and cancellation throw HttpClient's own HttpRequestException and OperationCanceledException. See error handling.
Example
using IdealPostcodes;
using var client = new IdealPostcodesClient("ak_test", "uk_test");
var response = await client.UpdateKeyDetailsAsync("ak_test", new UpdateKeyDetailsBody
{
Name = "Checkout",
AllowedUrls = ["https://www.example.com"],
});
Console.WriteLine(response.Result.Name);