Learn how to serialize the data for the keys to import in JSON, XML, or CSV format.

Encoding JSON key data

Structure the API key JSON data such as this example:

[
  {
    "value": "cf527010-63e8-45ae-91e2-29757180631e",
    "label": "premium",
    "tags": [
      "external",
      "premium"
    ]
  },
  {
    "value": "cf557010-63e8-45fg-94e2-29757180631e",
    "label": "premium",
    "tags": [
      "premium",
      "temp"
    ]
  }
]

In the JSON request object, escape all quotation marks with a backslash. Optionally, remove all whitespaces or use the \n character sequences to denote newlines.

{
    "name": "import.json",
    "content": "[{\"value\":\"cf527010-63e8-45ae-91e2-29757180631e\",\"label\":\"premium\",\"tags\":[\"external\",\"premium\"]},{\"value\":\"cf557010-63e8-45fg-94e2-29757180631e\",\"label\":\"premium\",\"tags\":[\"premium\",\"temp\"]}]",
    "collectionId": 58002
}

Encoding XML key data

Structure the API key XML data. If you assign more than one tag value to a key, use a semicolon to delimit the values such as this example:

<?xml version="1.0"?>
<keys>
   <key>
      <value>cf527010-63e8-45ae-91e2-29757180631e</value>
      <label>premium</label>
      <tags>external;premium</tags>
   </key>
</keys>

In the JSON request object, escape all quotation marks with a backslash. Optionally, remove all whitespaces between XML tags or use the \n character sequences to denote newlines.

{
    "name": "import.xml",
    "content":"<?xml version=\"1.0\"?><keys><key><value>cf527010-63e8-45ae-91e2-29757180631e</value><label>premium</label><tags>external;premium</tags></key></keys>",
    "collectionId": 58002
}

Encoding CSV key data

Structure the API key CSV data. If you assign more than one tag value to a key, use a semicolon to delimit the values. Make sure the fields VALUE, LABEL, and TAGS follow the order as in this example:

VALUE,LABEL,TAGS
cf527010-63e8-45ae-91e2-29757180631e,premium,external;premium
f557010-63e8-45fg-94e2-29757180631e,premium,premium;temp

In the JSON request object, use the newline character sequence (\n) to denote each newline in the CSV file.

{
    "name": "import.csv",
    "content": "VALUE,LABEL,TAGS\ncf527010-63e8-45ae-91e2-29757180631e,premium,external;premium\ncf557010-63e8-45fg-94e2-29757180631e,premium,premium;temp",
    "collectionId": 58002
}