{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://raw.githubusercontent.com/api-evangelist/entur/main/json-schema/entur-customer-response-schema.json",
  "title": "CustomerResponse",
  "description": "A registered customer response",
  "x-generated": "2026-10-09",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/entur-customers-openapi.yml#/components/schemas/CustomerResponse",
  "required": [
    "changedAt",
    "changedBy",
    "changedByChannel",
    "createdAt",
    "createdBy",
    "createdByChannel",
    "customerNumber",
    "firstName",
    "organisationId",
    "profileType",
    "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"
    },
    "customerAccounts": {
      "type": "array",
      "description": "Customer accounts used for account based ticketing",
      "items": {
        "$ref": "#/$defs/CustomerAccountResponse"
      }
    },
    "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": {
      "$ref": "#/$defs/LocalDateResponse"
    },
    "dateOfDeath": {
      "$ref": "#/$defs/LocalDateResponse"
    },
    "ecardOwnerships": {
      "type": "array",
      "description": "The ecards connected to the customer.",
      "items": {
        "$ref": "#/$defs/EcardOwnershipResponse"
      }
    },
    "email": {
      "maxLength": 80,
      "type": "string",
      "description": "Contact email. May become different from username"
    },
    "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
      }
    },
    "id": {
      "type": "integer",
      "description": "Customer id. Deprecated",
      "format": "int64",
      "deprecated": true
    },
    "landlineNumber": {
      "maxLength": 20,
      "type": "string",
      "description": "Landline telephone number."
    },
    "languagePreference": {
      "type": "string",
      "description": "Deprecated, please use languagePreferenceISO6393. Which language the customer wants information in. Default is 'NO'.",
      "deprecated": true,
      "enum": [
        "NO",
        "EN"
      ]
    },
    "languagePreferenceISO6393": {
      "type": "string",
      "description": "Which language the customer wants information in. ISO 639-3 format. Default is 'NOB'.",
      "enum": [
        "NOB",
        "NNO",
        "ENG"
      ]
    },
    "lastSignInAt": {
      "type": "string",
      "description": "When the customer last signed in. ISO 8601 date format",
      "format": "date-time"
    },
    "lastSignInFrom": {
      "maxLength": 100,
      "type": "string",
      "description": "Where the customer last signed in from. Typically web or app. Typically used to display to the user where the last login was performed."
    },
    "nationality": {
      "maxLength": 3,
      "minLength": 3,
      "type": "string",
      "description": "The customers nationality. ISO 3166-1 alpha-3 format"
    },
    "notes": {
      "type": "array",
      "description": "Deprecated. The notes connected to the customer.",
      "deprecated": true,
      "items": {
        "$ref": "#/$defs/NoteResponse"
      }
    },
    "organisationId": {
      "type": "integer",
      "description": "The organisation the customer is registered with.",
      "format": "int64"
    },
    "parentId": {
      "type": "object",
      "description": "Id of the parent customer. Used to connect different customer types."
    },
    "personnelTicketBearer": {
      "$ref": "#/$defs/PersonnelTicketBearer"
    },
    "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"
      }
    },
    "profileType": {
      "type": "string",
      "description": "Type of profile. Types supported: 'S' = Standard customer, 'P' = Personnel ticket customer, 'T' = Temporary customer. Default is 'S'.",
      "enum": [
        "S",
        "P",
        "T"
      ]
    },
    "relatedCustomerNumbers": {
      "type": "array",
      "description": "The customer number of profiles which has been merged into the current profile. These may be used to lookup customer information in other systems",
      "items": {
        "type": "integer",
        "description": "The customer number of profiles which has been merged into the current profile. These may be used to lookup customer information in other systems",
        "format": "int64"
      }
    },
    "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"
    },
    "username": {
      "type": "string",
      "description": "Username the customer can use to log unto their profile. Only available on profile type S(tamkunde) and profile status A(ctive)"
    },
    "uuid": {
      "maxLength": 32,
      "minLength": 32,
      "type": "string",
      "description": "A universal unique id for the customer. 32 random alphanumeric characters. Not RFC 4122 compliant"
    },
    "vippsId": {
      "type": "string",
      "description": "Deprecated. The field is no longer stored. Vipps unique user identifier.",
      "format": "uuid",
      "deprecated": true
    }
  },
  "$defs": {
    "CustomerAccountResponse": {
      "required": [
        "createdAt",
        "createdBy",
        "customerAccountId",
        "customerNumber",
        "id"
      ],
      "type": "object",
      "properties": {
        "alias": {
          "type": "string",
          "description": "Alias for the customer account"
        },
        "changedAt": {
          "type": "string",
          "description": "When the customer account was last changed. ISO 8601 date format",
          "format": "date-time"
        },
        "changedBy": {
          "type": "string",
          "description": "Who changed the customer account."
        },
        "createdAt": {
          "type": "string",
          "description": "When the customer account was created. ISO 8601 date format",
          "format": "date-time"
        },
        "createdBy": {
          "type": "string",
          "description": "Who created the customer account."
        },
        "customerAccountId": {
          "type": "string",
          "description": "Customer account id string"
        },
        "customerNumber": {
          "type": "integer",
          "description": "Unique customer number",
          "format": "int64"
        },
        "id": {
          "type": "integer",
          "description": "Customer account unique id.",
          "format": "int64"
        },
        "isDefault": {
          "type": "boolean",
          "description": "True if the account is the default account for the customer"
        }
      },
      "description": "Customer account connected to a customer"
    },
    "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"
    },
    "EcardOwnershipResponse": {
      "required": [
        "changedAt",
        "createdAt",
        "customerId",
        "ecardNumber",
        "ecardNumber16digits",
        "ecardOperator",
        "id",
        "startOfOwnership"
      ],
      "type": "object",
      "properties": {
        "bookingDate": {
          "type": "string",
          "description": "When the physical ecard was booked. ISO 8601 date format",
          "format": "date-time"
        },
        "changedAt": {
          "type": "string",
          "description": "When the ecard was last changed. ISO 8601 date format",
          "format": "date-time"
        },
        "createdAt": {
          "type": "string",
          "description": "When the ecard was created. ISO 8601 date format",
          "format": "date-time"
        },
        "customerId": {
          "type": "integer",
          "description": "The customer connected to the ecard. Deprecated",
          "format": "int64",
          "deprecated": true
        },
        "ecardName": {
          "maxLength": 100,
          "type": "string",
          "description": "Customer defined ecard alias."
        },
        "ecardNumber": {
          "type": "integer",
          "description": "Ecard number.",
          "format": "int64"
        },
        "ecardNumber16digits": {
          "maxLength": 16,
          "minLength": 16,
          "type": "string",
          "description": "The 16 digit ecard number. A combination of ecardNumber, ecardOperator and control digit."
        },
        "ecardOperator": {
          "type": "integer",
          "description": "Ecard operator.",
          "format": "int32"
        },
        "endOfOwnership": {
          "type": "string",
          "description": "When the customer removed the ecard connection. ISO 8601 date format",
          "format": "date-time"
        },
        "expirationDate": {
          "type": "string",
          "description": "When the physical ecard expires. ISO 8601 date format",
          "format": "date-time"
        },
        "id": {
          "type": "integer",
          "description": "Ecard id.",
          "format": "int64"
        },
        "shippingDate": {
          "type": "string",
          "description": "When the physical ecard was shipped to the customer. ISO 8601 date format",
          "format": "date-time"
        },
        "startOfOwnership": {
          "type": "string",
          "description": "When the ecard was first connected to the customer. ISO 8601 date format",
          "format": "date-time"
        }
      },
      "description": "Ecards connected to a customer"
    },
    "LocalDateResponse": {
      "required": [
        "day",
        "month",
        "year"
      ],
      "type": "object",
      "properties": {
        "day": {
          "type": "integer",
          "description": "day of month",
          "format": "int32"
        },
        "month": {
          "type": "integer",
          "description": "month number",
          "format": "int32"
        },
        "year": {
          "type": "integer",
          "description": "year",
          "format": "int32"
        }
      },
      "description": "Date as object"
    },
    "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"
    },
    "PersonnelTicketBearer": {
      "type": "object",
      "properties": {
        "bearerCustomerId": {
          "type": "integer",
          "format": "int64"
        },
        "changedAt": {
          "type": "string",
          "format": "date-time"
        },
        "createdAt": {
          "type": "string",
          "format": "date-time"
        },
        "isSelfServedRetrieval": {
          "type": "boolean"
        },
        "ticketRightBearer": {
          "type": "string"
        },
        "ticketRightOwner": {
          "type": "string"
        }
      },
      "description": "The personnel tickets connected to the customer. Deprecated. Does not contain updated information."
    },
    "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"
    }
  }
}