Element

Type

Requirement

Description

Additional Note

email

string

Optional

Email address of the contact.

Should be a valid email format.

companyname

string

Optional

Name of the company.

 

fullname

string

Optional

Full name of the contact person.

 

phone

string

Optional

Phone number of the contact.

 

street1

string

Optional

First line of the contact's street address.

 

street2

string

Optional

Second line of the contact's street address.

 

city

string

Optional

City of the contact's address.

 

zip

string

Optional

ZIP or postal code.

 

state

string

Optional

State, province, or region.

 

country

string

Optional

Country of the contact.

ISO 3166-1 alpha-2 code format (e.g., US, DK).

language

string

Optional

Preferred language of the contact.

Must be ISO639 or ISO639-ISO3166-1 alpha-2 format (e.g., en, en-US). 

Edit the details of a specified contact

Example

The Legal (L) contact update:

Method PUT

https://dk-co.keepit.com/users/r4hsnr-ktb74l-bsq8ka/contacts/l

Body

<contact>
    <email>test123456789@keepit.com</email>
    <companyname>Company</companyname>
    <fullname>test123456789@keepit.com</fullname>
    <phone>11111111111111</phone>
    <street1>TheExampleStreet</street1>
    <city>Copenhagen</city>
    <language>en-GB</language>
</contact>

Response

Code: 200 OK

Response body:

Successfully updated contact details.

PowerShell script

try {
    $username = '<Token username>'
    $password = '<Token password>'
    $userId = '<Account ID>'
    $contactType = 'p'  # Indicate contact type: p/e/f/l

    $basicauth = [Convert]::ToBase64String([System.Text.Encoding]::ASCII.GetBytes("${username}:${password}"))   

    $headers = @{
        "User-Agent"    = "PowerShell-Keepit-API-Agent-1.0"
        "Authorization" = "Basic $basicauth"
        "Content-Type"  = "application/xml"
    }

    $url = "https://dk-co.keepit.com/users/$userId/contacts/$contactType"

    $xmlBody = @"
<contact>
    <email>test123456789@keepit.com</email>
    <companyname>Company</companyname>
    <fullname>test123456789@keepit.com</fullname>
    <phone>11111111111111</phone>
    <street1>TheExampleStreet</street1>
    <city>Copenhagen</city>
    <language>en-GB</language>
</contact>
"@

    $response = Invoke-WebRequest -Uri $url -Method PUT -Headers $headers -Body $xmlBody -ErrorAction Stop -TimeoutSec 10

    Write-Host $response.Content

}
catch {
    $line = $_.InvocationInfo.ScriptLineNumber
    Write-Host "Cannot query Keepit API due to: $_"
    Write-Host "at line $line"
}

Additional information

  • Only include the fields that need to be updated. Fields that are not specified will remain unchanged.
  • To remove a parameter (if removable), provide an empty value.