# Upsert a customer Creates or updates (upserts) a customer with a specified ID. If the customer already has an identifier within your system, and you want to create a customer with a specified ID — use this operation to prevent duplicate customers. For more information, see Prevent duplicate customers. Endpoint: PUT /customers/{id} Version: latest Security: SecretApiKey, JWT ## Path parameters: - `id` (string, required) ID of the resource. ## Request fields (application/json): - `websiteId` (string) ID of the website. A website is where an organization obtains a customer. For more information, see [Obtain an organization ID and website ID](https://www.rebilly.com/docs/settings/organizations-and-websites/#obtain-your-organization-id-and-website-id). Example: "web_0YV7DE4Z26DQSA1AC92FBJ7SEG" - `paymentToken` (string) Write-only payment token. If supplied, the token is converted into a payment instrument and set as the value. If both are supplied, the value of this property overrides the value. The token expires after first use. - `defaultPaymentInstrument` (object,null) - `preferredPayoutInstrumentId` (string,null) ID of the customer's preferred payment instrument for payouts. Example: "inst_0YVB8KPKNXCBR9EDX7JHSED75N" - `customFields` (object) Use custom fields to extend a resource scheme to include custom data that is not provided as a common field. For more information, see [Custom fields](https://www.rebilly.com/catalog/all/custom-fields). Example: {"foo":"bar"} - `primaryAddress` (object,null) Customer's primary address. - `primaryAddress.firstName` (string,null) Contact's first name. Example: "Benjamin" - `primaryAddress.lastName` (string,null) Contact's last name. Example: "Franklin" - `primaryAddress.organization` (string,null) Contact's organization. Example: "Rebilly" - `primaryAddress.address` (string,null) First line of the contact's street address. Example: "36 Craven St" - `primaryAddress.address2` (string,null) Second line of the contact's street address. - `primaryAddress.city` (string,null) Contact's city of residence. Example: "Austin" - `primaryAddress.region` (string,null) Contact's region of residence. Example: "Texas" - `primaryAddress.country` (string,null) Contact's country of residence in ISO 3166 alpha-2 country code. For examples, see [ISO.org](https://www.iso.org/obp/ui/#search/code/). Example: "GB" - `primaryAddress.postalCode` (string,null) Contact's postal code. Example: "WC2N 5NF" - `primaryAddress.phoneNumbers` (array) List of phone numbers associated with the contact. - `primaryAddress.phoneNumbers.label` (string, required) Phone number label or name. Example: "main" - `primaryAddress.phoneNumbers.value` (string, required) Phone number value. Example: "1-512-777-0269" - `primaryAddress.phoneNumbers.primary` (boolean) Specifies if the phone number is the contact's primary phone number. Example: true - `primaryAddress.emails` (array) List of email addresses associated with the contact. - `primaryAddress.emails.label` (string, required) Email label or name. Example: "main" - `primaryAddress.emails.value` (string, required) Email address value. Example: "rebilly@example.com" - `primaryAddress.emails.primary` (boolean) Specifies if the email address is the contact's primary email address. Example: true - `primaryAddress.dob` (string,null) Contact's date of birth in ISO-8601 format. Example: "1980-04-01" - `primaryAddress.jobTitle` (string,null) Contact's job title. Example: "CEO" - `isEddRequired` (boolean) Specifies if Enhanced Due Diligence (EDD) is enabled for this customer. For more information, see [Enhanced Due Diligence](https://www.rebilly.com/docs/kyc-and-aml/edd/). - `locale` (string,null) Language locale identifier in [RFC 5646](https://tools.ietf.org/html/rfc5646) format. Example: "fr-FR" - `taxNumbers` (array,null) Tax numbers of the customer. - `taxNumbers.type` (string, required) Type of the tax number. Enum: "eu-vat", "other" - `taxNumbers.value` (string, required) Value of the tax number. Example: "GB980780684" - `taxNumbers.isDefault` (boolean) Determines if the tax number is selected as default to display on invoices. Example: true - `leadSource` (object) Lead source information. - `leadSource.medium` (string,null) Category of the lead source traffic. For example, the medium could be organic search, Google ads, Display ads, and so on. - `leadSource.source` (string,null) Domain, platform, or channel from which the lead source originates. - `leadSource.campaign` (string,null) Campaign name of the lead source. - `leadSource.term` (string,null) Term associated with a lead source. - `leadSource.content` (string,null) Content contained in the lead source content. For example, content could be graphics, video, and so on. - `leadSource.affiliate` (string,null) Individual or entity that is affiliated with the lead source. - `leadSource.subAffiliate` (string,null) Individual or entity that is associated with a lead source affiliate. In other products, this field may also be referred to as sub ID or click ID in some. - `leadSource.salesAgent` (string,null) Name of the sales agent associated with the lead source. - `leadSource.clickId` (string,null) ID of the lead source click. This value is passed in the ad click URL for tracking and campaign attribution. - `leadSource.path` (string,null) URL from which the lead source originates. - `leadSource.referrer` (string,null) Lead source [ URL](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Referer). ## Response 200 fields (application/json): - `id` (string) ID of the customer. Example: "cus_0YV7DDSDD1C8DA64KHH2W33CPF" - `email` (string,null) Customer's email address. - `firstName` (string,null) Customer's first name. - `lastName` (string,null) Customer's last name. - `websiteId` (string) ID of the website. A website is where an organization obtains a customer. For more information, see [Obtain an organization ID and website ID](https://www.rebilly.com/docs/settings/organizations-and-websites/#obtain-your-organization-id-and-website-id). Example: "web_0YV7DE4Z26DQSA1AC92FBJ7SEG" - `defaultPaymentInstrument` (object,null) - `preferredPayoutInstrumentId` (string,null) ID of the customer's preferred payment instrument for payouts. Example: "inst_0YVB8KPKNXCBR9EDX7JHSED75N" - `createdTime` (string) Date and time which is set automatically when the resource is created. - `updatedTime` (string) Date and time which updates automatically when the resource is updated. - `customFields` (object) Use custom fields to extend a resource scheme to include custom data that is not provided as a common field. For more information, see [Custom fields](https://www.rebilly.com/catalog/all/custom-fields). Example: {"foo":"bar"} - `primaryAddress` (object,null) Customer's primary address. - `primaryAddress.firstName` (string,null) Contact's first name. Example: "Benjamin" - `primaryAddress.lastName` (string,null) Contact's last name. Example: "Franklin" - `primaryAddress.organization` (string,null) Contact's organization. Example: "Rebilly" - `primaryAddress.address` (string,null) First line of the contact's street address. Example: "36 Craven St" - `primaryAddress.address2` (string,null) Second line of the contact's street address. - `primaryAddress.city` (string,null) Contact's city of residence. Example: "Austin" - `primaryAddress.region` (string,null) Contact's region of residence. Example: "Texas" - `primaryAddress.country` (string,null) Contact's country of residence in ISO 3166 alpha-2 country code. For examples, see [ISO.org](https://www.iso.org/obp/ui/#search/code/). Example: "GB" - `primaryAddress.postalCode` (string,null) Contact's postal code. Example: "WC2N 5NF" - `primaryAddress.phoneNumbers` (array) List of phone numbers associated with the contact. - `primaryAddress.phoneNumbers.label` (string, required) Phone number label or name. Example: "main" - `primaryAddress.phoneNumbers.value` (string, required) Phone number value. Example: "1-512-777-0269" - `primaryAddress.phoneNumbers.primary` (boolean) Specifies if the phone number is the contact's primary phone number. Example: true - `primaryAddress.emails` (array) List of email addresses associated with the contact. - `primaryAddress.emails.label` (string, required) Email label or name. Example: "main" - `primaryAddress.emails.value` (string, required) Email address value. Example: "rebilly@example.com" - `primaryAddress.emails.primary` (boolean) Specifies if the email address is the contact's primary email address. Example: true - `primaryAddress.dob` (string,null) Contact's date of birth in ISO-8601 format. Example: "1980-04-01" - `primaryAddress.jobTitle` (string,null) Contact's job title. Example: "CEO" - `primaryAddress.hash` (string) Use this value to compare contacts for identical attribute values. Example: "056ae6d97c788b9e98b049ebafd7b229bf852221" - `company` (object,null) Company information that is associated with the customer's primary email address domain. This is a paid feature, to enable it [contact Rebilly](https://www.rebilly.com/support/). - `company.name` (string,null) Name of the company. - `company.domain` (string) Website domain of the company. - `company.yearFounded` (number,null) Founding year of the company. - `company.industry` (string,null) Industry the company is associated with. - `company.employeesCount` (number,null) Number of employees in the company. - `company.country` (string,null) Country where the company is based. - `company.locality` (string,null) Locality or region where the company is based. - `company._links` (array) - `company._links.href` (string) Link URL. - `company._links.rel` (string) Type of link. Enum: "linkedin" - `averageValue` (object) Average customer value. - `averageValue.currency` (string) Currency code in ISO 4217 format. Example: "USD" - `averageValue.amount` (number) Average approved payment amount in merchant's reporting currency. - `averageValue.amountUsd` (number) Average approved payment amount in USD. - `paymentCount` (integer) Total number of approved payments made by the customer. Payments are the result of or transactions. - `lastPaymentTime` (string,null) Date and time of the customer's last approved payment. Payments are the result of or transactions. - `lifetimeRevenue` (object) Customer's lifetime revenue. - `lifetimeRevenue.amount` (number) Revenue amount in the merchant's reporting currency. - `lifetimeRevenue.amountUsd` (number) Revenue amount in USD. - `invoiceCount` (integer) Total number of invoices issued to the customer. This value is auto-incrementing. If this value is , the record relates to a lead. A lead is a customer who has not made a payment yet. If this value is greater than or equal to the record relates to a customer. - `tags` (array) List of customer tags. - `tags.id` (string) Unique resource ID. Example: "4f6cf35x-2c4y-483z-a0a9-158621f77a21" - `tags.name` (string, required) Unique name for the tag. Tag names are not case-sensitive. Example: "New" - `tags.type` (string, required) Type of tag. Tags of a specific type can only be assigned to corresponding entity types. For example, you can only use customer tags on customers. Enum: "customer", "kyc-document", "aml-check" - `tags._links` (array) Related links. - `revision` (integer) Number of times the customer's data has been modified. Use this value when analyzing webhook data to determine if a change must take precedence over the current representation. - `isEddRequired` (boolean) Specifies if Enhanced Due Diligence (EDD) is enabled for this customer. For more information, see [Enhanced Due Diligence](https://www.rebilly.com/docs/kyc-and-aml/edd/). - `hasFulfilledKyc` (boolean) Specifies if the customer has accepted and reviewed identity and address documents, or an accepted credit file document. - `organizationId` (string) Unique organization identifier. An organization is an entity that represents a company. For more information, see [Obtain an organization ID](https://www.rebilly.com/docs/settings/organizations-and-websites/#obtain-your-organization-id-and-website-id). Example: "org_0YVDM8RC7GDADADSBSMW124JA8" - `locale` (string,null) Language locale identifier in [RFC 5646](https://tools.ietf.org/html/rfc5646) format. Example: "fr-FR" - `taxNumbers` (array,null) Tax numbers of the customer. - `taxNumbers.type` (string, required) Type of the tax number. Enum: "eu-vat", "other" - `taxNumbers.value` (string, required) Value of the tax number. Example: "GB980780684" - `taxNumbers.isDefault` (boolean) Determines if the tax number is selected as default to display on invoices. Example: true - `taxNumbers.isValid` (boolean,null) Determines if the tax number passed the EU official [VIES validation](https://ec.europa.eu/taxation_customs/vies/#/vat-validation). Example: true - `_embedded` (object) Embedded objects that are requested using the query string parameter. - `_embedded.website` (object) - `_embedded.leadSource` (object) ## Response 201 fields (application/json): - `id` (string) ID of the customer. Example: "cus_0YV7DDSDD1C8DA64KHH2W33CPF" - `email` (string,null) Customer's email address. - `firstName` (string,null) Customer's first name. - `lastName` (string,null) Customer's last name. - `websiteId` (string) ID of the website. A website is where an organization obtains a customer. For more information, see [Obtain an organization ID and website ID](https://www.rebilly.com/docs/settings/organizations-and-websites/#obtain-your-organization-id-and-website-id). Example: "web_0YV7DE4Z26DQSA1AC92FBJ7SEG" - `defaultPaymentInstrument` (object,null) - `preferredPayoutInstrumentId` (string,null) ID of the customer's preferred payment instrument for payouts. Example: "inst_0YVB8KPKNXCBR9EDX7JHSED75N" - `createdTime` (string) Date and time which is set automatically when the resource is created. - `updatedTime` (string) Date and time which updates automatically when the resource is updated. - `customFields` (object) Use custom fields to extend a resource scheme to include custom data that is not provided as a common field. For more information, see [Custom fields](https://www.rebilly.com/catalog/all/custom-fields). Example: {"foo":"bar"} - `primaryAddress` (object,null) Customer's primary address. - `primaryAddress.firstName` (string,null) Contact's first name. Example: "Benjamin" - `primaryAddress.lastName` (string,null) Contact's last name. Example: "Franklin" - `primaryAddress.organization` (string,null) Contact's organization. Example: "Rebilly" - `primaryAddress.address` (string,null) First line of the contact's street address. Example: "36 Craven St" - `primaryAddress.address2` (string,null) Second line of the contact's street address. - `primaryAddress.city` (string,null) Contact's city of residence. Example: "Austin" - `primaryAddress.region` (string,null) Contact's region of residence. Example: "Texas" - `primaryAddress.country` (string,null) Contact's country of residence in ISO 3166 alpha-2 country code. For examples, see [ISO.org](https://www.iso.org/obp/ui/#search/code/). Example: "GB" - `primaryAddress.postalCode` (string,null) Contact's postal code. Example: "WC2N 5NF" - `primaryAddress.phoneNumbers` (array) List of phone numbers associated with the contact. - `primaryAddress.phoneNumbers.label` (string, required) Phone number label or name. Example: "main" - `primaryAddress.phoneNumbers.value` (string, required) Phone number value. Example: "1-512-777-0269" - `primaryAddress.phoneNumbers.primary` (boolean) Specifies if the phone number is the contact's primary phone number. Example: true - `primaryAddress.emails` (array) List of email addresses associated with the contact. - `primaryAddress.emails.label` (string, required) Email label or name. Example: "main" - `primaryAddress.emails.value` (string, required) Email address value. Example: "rebilly@example.com" - `primaryAddress.emails.primary` (boolean) Specifies if the email address is the contact's primary email address. Example: true - `primaryAddress.dob` (string,null) Contact's date of birth in ISO-8601 format. Example: "1980-04-01" - `primaryAddress.jobTitle` (string,null) Contact's job title. Example: "CEO" - `primaryAddress.hash` (string) Use this value to compare contacts for identical attribute values. Example: "056ae6d97c788b9e98b049ebafd7b229bf852221" - `company` (object,null) Company information that is associated with the customer's primary email address domain. This is a paid feature, to enable it [contact Rebilly](https://www.rebilly.com/support/). - `company.name` (string,null) Name of the company. - `company.domain` (string) Website domain of the company. - `company.yearFounded` (number,null) Founding year of the company. - `company.industry` (string,null) Industry the company is associated with. - `company.employeesCount` (number,null) Number of employees in the company. - `company.country` (string,null) Country where the company is based. - `company.locality` (string,null) Locality or region where the company is based. - `company._links` (array) - `company._links.href` (string) Link URL. - `company._links.rel` (string) Type of link. Enum: "linkedin" - `averageValue` (object) Average customer value. - `averageValue.currency` (string) Currency code in ISO 4217 format. Example: "USD" - `averageValue.amount` (number) Average approved payment amount in merchant's reporting currency. - `averageValue.amountUsd` (number) Average approved payment amount in USD. - `paymentCount` (integer) Total number of approved payments made by the customer. Payments are the result of or transactions. - `lastPaymentTime` (string,null) Date and time of the customer's last approved payment. Payments are the result of or transactions. - `lifetimeRevenue` (object) Customer's lifetime revenue. - `lifetimeRevenue.amount` (number) Revenue amount in the merchant's reporting currency. - `lifetimeRevenue.amountUsd` (number) Revenue amount in USD. - `invoiceCount` (integer) Total number of invoices issued to the customer. This value is auto-incrementing. If this value is , the record relates to a lead. A lead is a customer who has not made a payment yet. If this value is greater than or equal to the record relates to a customer. - `tags` (array) List of customer tags. - `tags.id` (string) Unique resource ID. Example: "4f6cf35x-2c4y-483z-a0a9-158621f77a21" - `tags.name` (string, required) Unique name for the tag. Tag names are not case-sensitive. Example: "New" - `tags.type` (string, required) Type of tag. Tags of a specific type can only be assigned to corresponding entity types. For example, you can only use customer tags on customers. Enum: "customer", "kyc-document", "aml-check" - `tags._links` (array) Related links. - `revision` (integer) Number of times the customer's data has been modified. Use this value when analyzing webhook data to determine if a change must take precedence over the current representation. - `isEddRequired` (boolean) Specifies if Enhanced Due Diligence (EDD) is enabled for this customer. For more information, see [Enhanced Due Diligence](https://www.rebilly.com/docs/kyc-and-aml/edd/). - `hasFulfilledKyc` (boolean) Specifies if the customer has accepted and reviewed identity and address documents, or an accepted credit file document. - `organizationId` (string) Unique organization identifier. An organization is an entity that represents a company. For more information, see [Obtain an organization ID](https://www.rebilly.com/docs/settings/organizations-and-websites/#obtain-your-organization-id-and-website-id). Example: "org_0YVDM8RC7GDADADSBSMW124JA8" - `locale` (string,null) Language locale identifier in [RFC 5646](https://tools.ietf.org/html/rfc5646) format. Example: "fr-FR" - `taxNumbers` (array,null) Tax numbers of the customer. - `taxNumbers.type` (string, required) Type of the tax number. Enum: "eu-vat", "other" - `taxNumbers.value` (string, required) Value of the tax number. Example: "GB980780684" - `taxNumbers.isDefault` (boolean) Determines if the tax number is selected as default to display on invoices. Example: true - `taxNumbers.isValid` (boolean,null) Determines if the tax number passed the EU official [VIES validation](https://ec.europa.eu/taxation_customs/vies/#/vat-validation). Example: true - `_embedded` (object) Embedded objects that are requested using the query string parameter. - `_embedded.website` (object) - `_embedded.leadSource` (object) ## Response 401 fields (application/json): - `status` (integer) HTTP status code. - `type` (string) Problem type in the form of a [URI](https://tools.ietf.org/html/rfc3986) reference. It should provide human-readable documentation for the problem type. When this member is not present, its value is assumed to be "about:blank". - `title` (string) Short, human-readable summary of the problem type. Other than for the purposes of localization, this should not change from occurrence to occurrence of the problem. - `detail` (string) Human-readable explanation that is specific to this occurrence of the problem. - `instance` (string) URI reference that identifies the specific occurrence of the problem. It may or may not yield further information if dereferenced. ## Response 403 fields (application/json): - `status` (integer) HTTP status code. - `type` (string) Problem type in the form of a [URI](https://tools.ietf.org/html/rfc3986) reference. It should provide human-readable documentation for the problem type. When this member is not present, its value is assumed to be "about:blank". - `title` (string) Short, human-readable summary of the problem type. Other than for the purposes of localization, this should not change from occurrence to occurrence of the problem. - `detail` (string) Human-readable explanation that is specific to this occurrence of the problem. - `instance` (string) URI reference that identifies the specific occurrence of the problem. It may or may not yield further information if dereferenced. ## Response 409 fields (application/json): - `status` (integer) HTTP status code. - `type` (string) Problem type in the form of a [URI](https://tools.ietf.org/html/rfc3986) reference. It should provide human-readable documentation for the problem type. When this member is not present, its value is assumed to be "about:blank". - `title` (string) Short, human-readable summary of the problem type. Other than for the purposes of localization, this should not change from occurrence to occurrence of the problem. - `detail` (string) Human-readable explanation that is specific to this occurrence of the problem. - `instance` (string) URI reference that identifies the specific occurrence of the problem. It may or may not yield further information if dereferenced. ## Response 422 fields (application/json): - `status` (integer) HTTP status code. - `type` (string) Problem type in the form of a [URI](https://tools.ietf.org/html/rfc3986) reference. It should provide human-readable documentation for the problem type. When this member is not present, its value is assumed to be "about:blank". - `title` (string) Short, human-readable summary of the problem type. Other than for the purposes of localization, this should not change from occurrence to occurrence of the problem. - `detail` (string) Human-readable explanation that is specific to this occurrence of the problem. - `instance` (string) URI reference that identifies the specific occurrence of the problem. It may or may not yield further information if dereferenced. - `invalidFields` (array) Invalid field details. Example: [{"field":"field1","message":"field1 is invalid"},{"field":"subObject.field2","message":"field2 is invalid"},{"field":"subObject.field2","message":"another error in the field2"}] - `invalidFields.field` (string) Name of the field. Dot notation is used for nested object field names. - `invalidFields.message` (string) Message field. ## Response 429 fields (application/json): - `type` (string) Problem type in the form of a [URI](https://tools.ietf.org/html/rfc3986) reference. It should provide human-readable documentation for the problem type. When this member is not present, its value is assumed to be "about:blank". Example: "about:blank" - `title` (string) Short, human-readable summary of the problem type. Other than for the purposes of localization, this should not change from occurrence to occurrence of the problem. Example: "Rate Limit Exceeded" - `status` (integer) HTTP status code. - `detail` (string) Human-readable explanation that is specific to this occurrence of the problem. Example: "A request cannot be executed because the user has sent too many requests within a certain period of time" - `instance` (string) URI reference that identifies the specific occurrence of the problem. It may or may not yield further information if dereferenced.