{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://raw.githubusercontent.com/api-evangelist/entur/main/json-schema/entur-temporary-customer-response-schema.json",
  "title": "TemporaryCustomerResponse",
  "description": "A registered customer",
  "x-generated": "2026-10-09",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/entur-customers-openapi.yml#/components/schemas/TemporaryCustomerResponse",
  "required": [
    "changedAt",
    "changedBy",
    "changedByChannel",
    "createdAt",
    "createdBy",
    "createdByChannel",
    "customerNumber",
    "expirationDate",
    "firstName",
    "organisationId",
    "status",
    "surname",
    "uuid"
  ],
  "type": "object",
  "properties": {
    "changedAt": {
      "type": "string",
      "description": "When the customer was last changed. ISO 8601 date format",
      "format": "date-time"
    },
    "changedBy": {
      "maxLength": 100,
      "type": "string",
      "description": "Who last changed the customer. Either web, app or username of employee. Used for traceability in accordance with GDPR"
    },
    "changedByChannel": {
      "maxLength": 100,
      "type": "string",
      "description": "Which sales channel or system who last changed the customer. Used for traceability in accordance with GDPR"
    },
    "countryCode": {
      "maxLength": 4,
      "type": "string",
      "description": "Telephone number country code, starting with +."
    },
    "createdAt": {
      "type": "string",
      "description": "When the customer was created. ISO 8601 date format",
      "format": "date-time"
    },
    "createdBy": {
      "maxLength": 100,
      "type": "string",
      "description": "Who created the customer. Either web, app or username of employee. Used for traceability in accordance with GDPR"
    },
    "createdByChannel": {
      "maxLength": 100,
      "type": "string",
      "description": "Which sales channel or system who created the customer. Used for traceability in accordance with GDPR"
    },
    "customerAccountId": {
      "maxLength": 60,
      "type": "string",
      "description": "Customer account id used for account based ticketing"
    },
    "customerConsents": {
      "type": "array",
      "description": "The legacy consents connected to the customer.",
      "items": {
        "$ref": "#/$defs/CustomerConsent"
      }
    },
    "customerNumber": {
      "type": "integer",
      "description": "Customer number.",
      "format": "int64"
    },
    "customerRef": {
      "maxLength": 40,
      "type": "string",
      "description": "Optional customer reference. Defaults to customer number if not set."
    },
    "dateOfBirth": {
      "type": "string",
      "description": "Date of birth. ISO 8601 date format",
      "format": "date"
    },
    "dateOfDeath": {
      "type": "string",
      "description": "Date of death. ISO 8601 date format",
      "format": "date"
    },
    "email": {
      "maxLength": 80,
      "type": "string",
      "description": "Contact email."
    },
    "emailOld": {
      "maxLength": 80,
      "type": "string",
      "description": "When customer is deleted (status='D'), the value of 'email' is moved here to allow creation of a new customer with the same email."
    },
    "emailVerifiedAt": {
      "type": "string",
      "description": "When the email was verified. ISO 8601 date format",
      "format": "date-time"
    },
    "expirationDate": {
      "type": "string",
      "description": "The date when the customers personal data should be deleted. Personal data will be deleted continuously. ISO 8601 date format",
      "format": "date-time"
    },
    "firstName": {
      "maxLength": 50,
      "type": "string",
      "description": "First and middle name."
    },
    "givenConsents": {
      "type": "array",
      "description": "The consents connected to the customer. Deprecated",
      "deprecated": true,
      "items": {
        "type": "object",
        "description": "The consents connected to the customer. Deprecated",
        "deprecated": true
      }
    },
    "landlineNumber": {
      "maxLength": 20,
      "type": "string",
      "description": "Landline telephone number."
    },
    "nationality": {
      "maxLength": 3,
      "type": "string",
      "description": "The customers nationality. ISO 3166-1 alpha-3 format"
    },
    "notes": {
      "type": "array",
      "description": "The notes connected to the customer.",
      "items": {
        "$ref": "#/$defs/NoteResponse"
      }
    },
    "organisationId": {
      "type": "integer",
      "description": "The organisation the customer is registered with.",
      "format": "int64"
    },
    "postalAddresses": {
      "type": "array",
      "description": "The postal addresses connected to the customer.",
      "items": {
        "$ref": "#/$defs/PostalAddressResponse"
      }
    },
    "preferences": {
      "type": "array",
      "description": "The preferences connected to the customer.",
      "items": {
        "$ref": "#/$defs/CustomerPreferenceResponse"
      }
    },
    "status": {
      "type": "string",
      "description": "Customer status. Statuses supported: 'A' = Active, 'P' = Passive, 'D' = Deleted. Default is 'A'.",
      "enum": [
        "A",
        "P",
        "D"
      ]
    },
    "surname": {
      "maxLength": 50,
      "type": "string",
      "description": "Surname."
    },
    "telephoneNumber": {
      "maxLength": 20,
      "type": "string",
      "description": "Deprecated. Please use countryCode and telephoneNumberNoCountryCode. Telephone number for customer. This should be a cell phone number."
    },
    "telephoneNumberNoCountryCode": {
      "maxLength": 12,
      "type": "string",
      "description": "Telephone number without country code or punctuation."
    },
    "telephoneNumberVerifiedAt": {
      "type": "string",
      "description": "When the telephone number was verified. ISO 8601 date format",
      "format": "date-time"
    },
    "uuid": {
      "maxLength": 32,
      "minLength": 32,
      "type": "string",
      "description": "A universal unique id for the customer. 32 random alphanumeric characters. Not RFC 4122 compliant"
    }
  },
  "$defs": {
    "CustomerConsent": {
      "type": "object",
      "properties": {
        "changedAt": {
          "type": "string",
          "description": "When the customer consent was last changed.",
          "format": "date-time"
        },
        "consentChoice": {
          "type": "boolean",
          "description": "Whether the customer has approved or declined this consent."
        },
        "consentCode": {
          "maxLength": 20,
          "type": "string",
          "description": "The consent code."
        },
        "createdAt": {
          "type": "string",
          "description": "When the customer consent was created.",
          "format": "date-time"
        },
        "customerId": {
          "type": "integer",
          "description": "Id of the customer.",
          "format": "int64"
        }
      },
      "description": "Legacy consents for a customer"
    },
    "CustomerPreferenceResponse": {
      "required": [
        "changedAt",
        "createdAt",
        "preference",
        "preferenceId"
      ],
      "type": "object",
      "properties": {
        "changedAt": {
          "type": "string",
          "description": "When the customer preference was last changed. ISO 8601 date format",
          "format": "date-time"
        },
        "createdAt": {
          "type": "string",
          "description": "When the customer preference was created. ISO 8601 date format",
          "format": "date-time"
        },
        "customerId": {
          "type": "integer",
          "description": "Id of the customer. Deprecated",
          "format": "int64",
          "deprecated": true
        },
        "preference": {
          "$ref": "#/$defs/PreferenceResponse"
        },
        "preferenceId": {
          "type": "integer",
          "description": "Id of the preference",
          "format": "int64"
        },
        "preferenceValue": {
          "maxLength": 100,
          "minLength": 1,
          "type": "string",
          "description": "Value of the preference. This can be things like membership number."
        }
      },
      "description": "Preferences response for a customer"
    },
    "NoteResponse": {
      "required": [
        "changedAt",
        "changedBy",
        "createdAt",
        "createdBy",
        "customerId",
        "id",
        "text"
      ],
      "type": "object",
      "properties": {
        "changedAt": {
          "type": "string",
          "description": "When the note was last changed. ISO 8601 date format",
          "format": "date-time"
        },
        "changedBy": {
          "maxLength": 100,
          "type": "string",
          "description": "Who last changed the note."
        },
        "createdAt": {
          "type": "string",
          "description": "When the note was created. ISO 8601 date format",
          "format": "date-time"
        },
        "createdBy": {
          "maxLength": 100,
          "type": "string",
          "description": "Who created the note."
        },
        "customerId": {
          "type": "integer",
          "description": "Id of the customer connected to the note.",
          "format": "int64"
        },
        "id": {
          "type": "integer",
          "description": "Note id.",
          "format": "int64"
        },
        "text": {
          "maxLength": 4000,
          "type": "string",
          "description": "Note content."
        }
      },
      "description": "Deprecated"
    },
    "PostalAddressResponse": {
      "required": [
        "changedAt",
        "countryCode",
        "createdAt",
        "customerId",
        "id",
        "postCode",
        "town",
        "typeOfAddress"
      ],
      "type": "object",
      "properties": {
        "addressLine1": {
          "maxLength": 80,
          "type": "string",
          "description": "Address line 1."
        },
        "addressLine2": {
          "maxLength": 80,
          "type": "string",
          "description": "Address line 2, often used for c/o information."
        },
        "changedAt": {
          "type": "string",
          "description": "When the postal address was last changed. ISO 8601 date format",
          "format": "date-time"
        },
        "countryCode": {
          "maxLength": 3,
          "minLength": 3,
          "type": "string",
          "description": "The address country code. ISO 3166-1 alpha-3 format"
        },
        "createdAt": {
          "type": "string",
          "description": "When the postal address was created. ISO 8601 date format",
          "format": "date-time"
        },
        "customerId": {
          "type": "integer",
          "description": "The customer connected to the address.",
          "format": "int64"
        },
        "id": {
          "type": "integer",
          "description": "Postal address id.",
          "format": "int64"
        },
        "postCode": {
          "maxLength": 10,
          "type": "string",
          "description": "The address post code."
        },
        "town": {
          "maxLength": 50,
          "type": "string",
          "description": "The address post town."
        },
        "typeOfAddress": {
          "type": "string",
          "description": "The type of address. Types supported: 'P' = Private, 'I' = Invoice, 'S' = Shadow.",
          "enum": [
            "P",
            "I",
            "S"
          ]
        },
        "verifiedAt": {
          "type": "string",
          "description": "When the address was verified. ISO 8601 date format",
          "format": "date-time"
        }
      },
      "description": "Postal address connected to a customer"
    },
    "PreferenceResponse": {
      "required": [
        "changedAt",
        "createdAt",
        "id",
        "isActive",
        "preferenceCode",
        "preferenceDescription",
        "preferenceType"
      ],
      "type": "object",
      "properties": {
        "changedAt": {
          "type": "string",
          "description": "When the preference was last changed. ISO 8601 date format",
          "format": "date-time"
        },
        "createdAt": {
          "type": "string",
          "description": "When the preference was created. ISO 8601 date format",
          "format": "date-time"
        },
        "id": {
          "type": "integer",
          "description": "Preference id.",
          "format": "int64"
        },
        "isActive": {
          "type": "boolean",
          "description": "Whether the preference is active."
        },
        "preferenceCode": {
          "maxLength": 20,
          "type": "string",
          "description": "The preference code."
        },
        "preferenceDescription": {
          "maxLength": 255,
          "type": "string",
          "description": "A description of the preference."
        },
        "preferenceType": {
          "maxLength": 20,
          "type": "string",
          "description": "Type of preference."
        }
      },
      "description": "Preference"
    }
  }
}