{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/nice/json-schema/nice-custom-card-request-schema.json",
  "title": "CustomCardRequest",
  "description": "Request to create a custom card for an interaction.",
  "x-generated": "2026-11-11",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/nice-realtimeinsights-openapi.yml#/components/schemas/CustomCardRequest",
  "required": [
    "card",
    "meta",
    "timestamp"
  ],
  "type": "object",
  "properties": {
    "timestamp": {
      "type": [
        "string",
        "null"
      ],
      "description": "Client timestamp of the request, in ISO 8601 format (UTC).",
      "format": "date-time"
    },
    "schemaVersion": {
      "type": [
        "string",
        "null"
      ],
      "description": "Schema version of the request payload."
    },
    "meta": {
      "required": [
        "contactNumber"
      ],
      "allOf": [
        {
          "$ref": "#/$defs/CustomCardRequestMeta"
        }
      ],
      "description": "Interaction metadata identifying which contact the card belongs to.",
      "nullable": true
    },
    "card": {
      "allOf": [
        {
          "$ref": "#/$defs/CustomCardItem"
        }
      ],
      "description": "The custom card content to create.",
      "nullable": true
    }
  },
  "additionalProperties": false,
  "$defs": {
    "CustomCardImage": {
      "type": "object",
      "properties": {
        "title": {
          "type": [
            "string",
            "null"
          ],
          "description": "Image title or alt text."
        },
        "url": {
          "type": [
            "string",
            "null"
          ],
          "description": "Full-size image URL."
        },
        "thumbUrl": {
          "type": [
            "string",
            "null"
          ],
          "description": "Thumbnail image URL."
        }
      },
      "additionalProperties": false,
      "description": "An image displayed on a custom card."
    },
    "CustomCardItem": {
      "type": "object",
      "properties": {
        "title": {
          "type": [
            "string",
            "null"
          ],
          "description": "Card title shown to the agent."
        },
        "text": {
          "type": [
            "string",
            "null"
          ],
          "description": "Card body text."
        },
        "prompt": {
          "allOf": [
            {
              "$ref": "#/$defs/CustomCardPrompt"
            }
          ],
          "description": "Optional prompt used to generate or populate the card.",
          "nullable": true
        },
        "links": {
          "type": [
            "array",
            "null"
          ],
          "items": {
            "$ref": "#/$defs/CustomCardLink"
          },
          "description": "Links displayed on the card."
        },
        "images": {
          "type": [
            "array",
            "null"
          ],
          "items": {
            "$ref": "#/$defs/CustomCardImage"
          },
          "description": "Images displayed on the card."
        },
        "icon": {
          "type": [
            "string",
            "null"
          ],
          "description": "Icon identifier or URL shown on the card."
        },
        "backgroundColor": {
          "type": [
            "string",
            "null"
          ],
          "description": "Background color of the card, as a hex color code."
        },
        "actions": {
          "type": [
            "array",
            "null"
          ],
          "items": {
            "type": "string"
          },
          "description": "Action identifiers available on the card."
        }
      },
      "additionalProperties": false,
      "description": "Content of a custom card: title, body text, optional prompt, links, images, and actions."
    },
    "CustomCardLink": {
      "type": "object",
      "properties": {
        "title": {
          "type": [
            "string",
            "null"
          ],
          "description": "Display text for the link."
        },
        "url": {
          "type": [
            "string",
            "null"
          ],
          "description": "Target URL of the link."
        }
      },
      "additionalProperties": false,
      "description": "A hyperlink displayed on a custom card."
    },
    "CustomCardPrompt": {
      "type": "object",
      "properties": {
        "uid": {
          "type": [
            "string",
            "null"
          ],
          "description": "Unique identifier of the prompt."
        },
        "transcript": {
          "allOf": [
            {
              "$ref": "#/$defs/CustomCardPromptTranscript"
            }
          ],
          "description": "Transcript context supplied to the prompt.",
          "nullable": true
        },
        "parameters": {
          "type": [
            "array",
            "null"
          ],
          "items": {
            "$ref": "#/$defs/CustomCardPromptParameter"
          },
          "description": "Parameters supplied to the prompt."
        }
      },
      "additionalProperties": false,
      "description": "Prompt used to generate or populate a custom card."
    },
    "CustomCardPromptParameter": {
      "type": "object",
      "properties": {
        "name": {
          "type": [
            "string",
            "null"
          ],
          "description": "Parameter name."
        },
        "value": {
          "type": [
            "string",
            "null"
          ],
          "description": "Parameter value."
        }
      },
      "additionalProperties": false,
      "description": "A name/value parameter supplied to a custom card prompt."
    },
    "CustomCardPromptTranscript": {
      "type": "object",
      "properties": {
        "agentContactUid": {
          "type": [
            "string",
            "null"
          ],
          "description": "Identifier of the agent's contact leg for the interaction."
        },
        "channel": {
          "type": [
            "string",
            "null"
          ],
          "description": "Channel of the interaction (e.g. digital or voice)."
        },
        "parameterName": {
          "type": [
            "string",
            "null"
          ],
          "description": "Name of the parameter the transcript populates."
        }
      },
      "additionalProperties": false,
      "description": "Transcript context supplied to a custom card prompt."
    },
    "CustomCardRequestMeta": {
      "required": [
        "contactNumber"
      ],
      "type": "object",
      "properties": {
        "contactNumber": {
          "type": [
            "integer",
            "null"
          ],
          "description": "Unique identifier of the contact/interaction the card is associated with.",
          "format": "int64"
        }
      },
      "additionalProperties": false,
      "description": "Interaction metadata for a custom card request."
    }
  }
}