# Update Contact Property

> PATCH /contact-properties/:id — update an existing contact property.

`PATCH /contact-properties/:id`

Update an existing contact property.

**Path parameters**

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `contact_property_id` | string | Yes | The Contact Property ID. |

> **Note:** The `key` and `type` fields cannot be changed after creation. This preserves data integrity for existing contact values.

**Body parameters**

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `fallback_value` | string | number | No | The default value to use when the property is not set for a contact. Must match the type of the property. |

**Node.js**

```js
import { MailBlastr } from 'mailblastr';

const mb = new MailBlastr('mb_xxxxxxxxx');

const { data, error } = await mb.contactProperties.update('b6d24b8e-af0b-4c3c-be0c-359bbd97381e', {
  "fallback_value": "Example Company"
});
console.log({ data, error });
```

**Ruby**

```ruby
require "mailblastr"

Mailblastr.api_key = "mb_xxxxxxxxx"

Mailblastr::ContactProperties.update("b6d24b8e-af0b-4c3c-be0c-359bbd97381e", {
  "fallback_value": "Example Company"
})
```

**PHP**

```php
$mailblastr = Mailblastr::client('mb_xxxxxxxxx');

$mailblastr->contactProperties->update('b6d24b8e-af0b-4c3c-be0c-359bbd97381e', [
  'fallback_value' => "Example Company"
]);
```

**Python**

```python
import mailblastr

mailblastr.api_key = "mb_xxxxxxxxx"

mailblastr.ContactProperties.update("b6d24b8e-af0b-4c3c-be0c-359bbd97381e", {
  "fallback_value": "Example Company"
})
```

**Go**

```go
package main

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

func main() {
    req, _ := http.NewRequest("PATCH", "https://api.mailblastr.com/contact-properties/b6d24b8e-af0b-4c3c-be0c-359bbd97381e", strings.NewReader(`{
  "fallback_value": "Example Company"
}`))
    req.Header.Set("Authorization", "Bearer mb_xxxxxxxxx")
    req.Header.Set("Content-Type", "application/json")
    res, _ := http.DefaultClient.Do(req)
    defer res.Body.Close()
    out, _ := io.ReadAll(res.Body)
    fmt.Println(string(out))
}
```

**Rust**

```rust
use reqwest::Client;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let res = Client::new()
        .patch("https://api.mailblastr.com/contact-properties/b6d24b8e-af0b-4c3c-be0c-359bbd97381e")
        .header("Authorization", "Bearer mb_xxxxxxxxx")
        .header("Content-Type", "application/json")
        .body(r#"{
  "fallback_value": "Example Company"
}"#)
        .send()
        .await?;
    println!("{}", res.text().await?);
    Ok(())
}
```

**Java**

```java
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;

var client = HttpClient.newHttpClient();
var request = HttpRequest.newBuilder()
    .uri(URI.create("https://api.mailblastr.com/contact-properties/b6d24b8e-af0b-4c3c-be0c-359bbd97381e"))
    .header("Authorization", "Bearer mb_xxxxxxxxx")
    .header("Content-Type", "application/json")
    .method("PATCH", HttpRequest.BodyPublishers.ofString("""
{
  "fallback_value": "Example Company"
}
"""))
    .build();
var response = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
```

**.NET**

```csharp
using System.Net.Http;
using System.Text;

var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Patch, "https://api.mailblastr.com/contact-properties/b6d24b8e-af0b-4c3c-be0c-359bbd97381e");
request.Headers.Add("Authorization", "Bearer mb_xxxxxxxxx");
request.Content = new StringContent(@"{
  ""fallback_value"": ""Example Company""
}", Encoding.UTF8, "application/json");
var response = await client.SendAsync(request);
Console.WriteLine(await response.Content.ReadAsStringAsync());
```

**cURL**

```bash
curl -X PATCH 'https://api.mailblastr.com/contact-properties/b6d24b8e-af0b-4c3c-be0c-359bbd97381e' \
  -H 'Authorization: Bearer mb_xxxxxxxxx' \
  -H 'Content-Type: application/json' \
  -d '{
  "fallback_value": "Example Company"
}'
```

**CLI**

```bash
mailblastr contact-properties update b6d24b8e-af0b-4c3c-be0c-359bbd97381e \
  --fallback-value 'Example Company'
```

### Response

```json
{
  "object": "contact_property",
  "id": "b6d24b8e-af0b-4c3c-be0c-359bbd97381e"
}
```
