---
updatedAt: 2026-08-01T11:27:34.000Z
agentTools:
  projectIndex: https://dev.kevel.com/llms.txt
---

# Set Custom Properties

With this you can tie Custom Properties to a specific UserKey using key/value pairs. For instance, `{"Key":"Value"}` could be `{"favoriteColor": "blue"}`.  Note that each call to set custom properties will replace any existing custom properties.

> ❗️
>
> The max size of a custom data object in a UserDB record is 8 KB.

> ❗️
>
> We recommend using either `camelCase` or `snake_case` custom property keys as these work well with Zerkel. However, `kebab-case` should be avoided. Also, symbol prefixes (like `$`, `%`, `:`, etc.) should not be used.

> 👍
>
> Note that the user key supplied in the `user` object will override a user key set via the `azk` cookie.

# OpenAPI definition

```json
{
  "openapi": "3.1.0",
  "info": {
    "title": "userdb",
    "version": "1.0"
  },
  "servers": [
    {
      "url": "https://e-{networkId}.adzerk.net/udb/{networkId}",
      "variables": {
        "networkId": {
          "default": "networkId"
        }
      }
    }
  ],
  "security": [
    {}
  ],
  "paths": {
    "/custom": {
      "post": {
        "summary": "Set Custom Properties",
        "description": "With this you can tie Custom Properties to a specific UserKey using key/value pairs. For instance, `{\"Key\":\"Value\"}` could be `{\"favoriteColor\": \"blue\"}`.  Note that each call to set custom properties will replace any existing custom properties.",
        "operationId": "set-custom-properties-to-user",
        "parameters": [
          {
            "name": "property",
            "in": "query",
            "description": "Appends one or more key/value pairs to be shipped to UserDB logs. In the format `?property:Key1=Value&property:Key2=Value` etc.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "networkId",
            "in": "path",
            "description": "Your account (network) ID",
            "schema": {
              "type": "integer",
              "format": "int32"
            },
            "required": true
          },
          {
            "in": "query",
            "name": "group",
            "schema": {
              "type": "integer"
            },
            "description": "Optional. Sets the user's incrementality group (1–100) as part of this request; use `group=null` to clear it, or omit to leave it unchanged. Invalid values reject the entire request."
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "Key/Value Object"
                ],
                "properties": {
                  "Key/Value Object": {
                    "type": "string",
                    "description": "This is a JSON object that can be anything since it's custom data. For instance, `{\"favoriteColor\": \"blue\"}`."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "200",
            "content": {
              "text/plain": {
                "examples": {
                  "Result": {
                    "value": "[Returns a 1x1 transparent GIF image]"
                  }
                }
              }
            }
          }
        },
        "security": [],
        "x-readme": {
          "code-samples": [
            {
              "language": "curl",
              "code": "curl -b \"azk=ue1-e397eb5990\" -X POST https://e-23.adzerk.net/udb/23/custom -d '{\"favoriteColor\":\"blue\"}'"
            },
            {
              "language": "javascript",
              "code": "const Adzerk = require('@adzerk/decision-sdk');\n\n// Demo network ID; find your own via the Adzerk UI!\nlet client = new Adzerk.Client({networkId: 23});\n\nlet props = {\n  favoriteColor: \"blue\",\n  favoriteNumber: 42,\n  favoriteFoods: [\"strawberries\", \"chocolate\"]\n};\n\nclient.userDb.setCustomProperties(\"ue1-e397eb5990\", props);\n"
            },
            {
              "language": "java",
              "code": "import java.util.*;\nimport com.adzerk.sdk.*;\nimport com.adzerk.sdk.generated.ApiException;\n\npublic class SetUserDb {\n  public static void main(String[] argv) throws ApiException {\n    // Demo network ID; find your own via the Adzerk UI!\n    Client client = new Client(new ClientOptions(23));\n\n    Map props = Map.of(\n      \"favoriteColor\", \"blue\",\n      \"favoriteNumber\", 42,\n      \"favoriteFoods\", new String[] {\"strawberries\", \"chocolate\"});\n\n    client.userDb().setCustomProperties(\"ue1-e397eb5990\", props);\n  }\n}"
            },
            {
              "language": "python",
              "code": "import adzerk_decision_sdk\n\n# Demo network ID; find your own via the Adzerk UI!\nclient = adzerk_decision_sdk.Client(23)\n\nprops = {\n  \"favoriteColor\": \"blue\",\n  \"favoriteNumber\": 42,\n  \"favoriteFoods\": [\"strawberries\", \"chocolate\"],\n}\n\nclient.user_db.set_custom_properties(\"ue1-e397eb5990\", props)"
            },
            {
              "language": "ruby",
              "code": "require \"adzerk_decision_sdk\"\n\n# Demo network ID; find your own via the Adzerk UI!\nclient = AdzerkDecisionSdk::Client.new(network_id: 23)\n\nprops = {\n  favoriteColor: \"blue\",\n  favoriteNumber: 42,\n  favoriteFoods: [\"strawberries\", \"chocolate\"],\n}\n\nclient.user_db.set_custom_properties(\"ue1-e397eb5990\", props)"
            },
            {
              "language": "clojure",
              "code": "(ns set-userdb-sample\n  (:import (com.adzerk.sdk Client ClientOptions)))\n\n(defn -main []\n  ; Demo network ID; find your own via the Adzerk UI!\n  (let [client (Client. (doto (ClientOptions. (int 23))))\n        props {\"favoriteColor\" \"blue\"\n               \"favoriteNumber\" 42\n               \"favoriteFoods\" [\"strawberries\", \"chocolate\"]}]\n    (-> client (.userDb) (.setCustomProperties \"ue1-e397eb5990\" props))))\n"
            },
            {
              "language": "swift",
              "code": "import AdzerkSDK\n\n// Demo network ID; find your own via the Adzerk UI!\nDecisionSDK.defaultNetworkId = 23\n\nlet keyStore = UserKeyStoreKeychain()\nkeyStore.save(userKey: \"abc\")\n\nlet client = DecisionSDK(keyStore: keyStore)\n\nlet props:[String: AnyCodable] = [\n    \"favoriteColor\":  .string(\"blue\"),\n    \"favoriteNumber\": .int(42),\n    \"favoriteFoods\":  .array([\n        .string(\"strawberries\"),\n        .string(\"chocolate\"),\n    ])\n]\n\nclient.userDB().postProperties(props) {response in\n  dump(response)\n}"
            }
          ],
          "samples-languages": [
            "curl",
            "javascript",
            "java",
            "python",
            "ruby",
            "clojure",
            "swift"
          ]
        }
      }
    }
  },
  "x-readme": {
    "headers": [],
    "explorer-enabled": false,
    "proxy-enabled": true
  },
  "x-readme-fauxas": true
}
```