API Documentation

Retrieve account settings

This command retrieves account settings. It can be executed either directly at the account level or from the parent account.

API request 

Method GET 

/users/{user-id}

Example

Method GET 

https://dk-co.keepit.com/users/nq2v51-5mx23m-qb7sah/

Response

<user>
    <enabled>true</enabled>
    <created>2024-11-21T11:03:16Z</created>
    <product>a9y02y-qngj1m-yvh5r8</product>
    <parent>716vh1-7r91yq-bxsob1</parent>
    <subscribed>true</subscribed>
</user>

PowerShell script

try { 
    # Define the API credentials and user ID 
    $username = '<API Token username>' 
    $password = '<API Token password>' 
    $userID = '<Account GUID>' 


    # Create the Basic Authentication header 
    $basicauth = [Convert]::ToBase64String([System.Text.Encoding]::ASCII.GetBytes("${username}:${password}")) 
    $headers = @{ 
        "User-Agent" = "PowerShell-Keepit-API-Agent-1.0" 
        "Authorization" = "Basic $basicauth" 
    } 

 
    # Construct the URL with the user ID 
    $url = "https://dk-co.keepit.com/users/$userID/" 


    # Send the GET request 
    $response = Invoke-WebRequest -Uri $url -Method Get -Headers $headers -ErrorAction Stop -TimeoutSec 10 


    # Parse the response content as XML 
    [xml]$xmlContent = $response.Content 


    # Display the result 
    foreach ($node in $xmlContent.user.ChildNodes) { 
        Write-Host "$($node.Name): $($node.InnerText)" 
    } 
} 
catch { 
    # Handle errors and provide line number and error message 
    $line = $_.InvocationInfo.ScriptLineNumber 
    Write-Host "Cannot query Keepit API due to: $_" 
    Write-Host "at line $line" 
} 

Additional information

You can select the desired response schema by setting the "Accept" header. Custom media types in the API allow consumers to specify the format of the data they wish to receive.

Header:

Accept: application/vnd.keepit.v{0|1}

If the "Accept" header does not include a version number, the response will default to schema v0.

Note: The <product> element reports the product directly assigned to the account. If no product is set on the account, it inherits the product from its parent account (and so on recursively). This API endpoint provides the product directly assigned to the account, not the inherited product. To determine the active product on the account, you must trace back to the parent accounts until a product is found.