Update a prospect
Operation ID: updateProspect
Group: CRM › Prospects
Open in the interactive reference
PATCH /crm/prospects/{id}
Retry-safe: A write that accepts Idempotency-Key: repeating a request with the same key replays the stored answer instead of executing twice.
Updates a prospect, its addresses and its contacts, applying the rules of the prospect form in the app. Every field is optional and an omitted field is left unchanged. An address takes only the fields you send; the required address fields (line1, city, country, zipCode) cannot be emptied. While sameAsBillToAddress is true the sold-to address is kept a copy of the bill-to address, so soldToAddress must be omitted. Contacts are changed with three arrays: createContacts adds new or existing contacts, updateContacts changes which contact is the default for each role, and deleteContacts removes contacts from the prospect (the contact records themselves are kept). A prospect that has been converted to a customer can no longer be changed and fails with PROSPECT_CONVERTED. The response is empty.
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
Api-Version |
header | string · v1 | yes | The API version this request targets, named by its public identifier. Required on every request; omitting it, or naming a version this company does not have, is answered with 400. This document describes version v1. |
Idempotency-Key |
header | string | no | An opaque caller-chosen string (1-255 characters) that makes this request safe to retry. Repeating the same key with an identical request body replays the original response instead of re-executing - but only once that original request succeeded; a failed attempt re-executes on retry. Repeating the key with a different body is answered with 422. A key still in flight is answered with 409 - as is a key whose original request was interrupted before it finished, for a few minutes afterwards, until that attempt is presumed dead. A completed response stays replayable for 24 hours. The key is scoped to the caller, not to the action: reusing it for a different action is answered with 409 or 422 rather than treated independently. On read actions this header is ignored. On write actions that cannot offer the guarantee it is answered with 400 IDEMPOTENCY_NOT_SUPPORTED rather than silently ignored. |
id |
path | string | yes | The unique identifier for the prospect to change. Example: "3b7d5e9c-1a24-4f80-9c6d-2e8f70b13a45". |
Request body
Required, application/json: updateProspectInput.
| Field | Type | Required | Description |
|---|---|---|---|
prospectName |
string | no | The name of the prospect organization. Must not be empty. Omit to leave unchanged. |
entityId |
string | no | The legal entity that owns the prospect. See id on GET base/entities. Omit to leave unchanged. |
billingEmail |
string | null | no | The email address invoices for this prospect would be sent to. Send null to clear, omit to leave unchanged. Example: "invoices@northwind.example". |
crmId |
string | null | no | The identifier of this prospect in an external CRM system. Send null to clear, omit to leave unchanged. |
customerType |
any | no | The commercial relationship. Omit to leave unchanged. One of: "default", "partner". |
defaultCurrency |
string | null | no | The currency quotes for this prospect default to, ISO 4217. Send null to clear, omit to leave unchanged. |
sameAsBillToAddress |
boolean | no | Whether the sold-to address repeats the bill-to address. Switching it on copies the bill-to address over the sold-to address. Omit to leave unchanged. |
billToAddress |
object | no | Changes to the bill-to address. Omit to leave it unchanged. Example: {"line1":"500 Terry Avenue North"}. |
billToAddress.line1 |
string | no | The first address line. Must not be empty. Omit to leave unchanged. |
billToAddress.line2 |
string | no | The second address line. Send an empty string to clear, omit to leave unchanged. |
billToAddress.city |
string | no | The city or locality. Must not be empty. Omit to leave unchanged. |
billToAddress.stateProvince |
string | no | The state, province or region, as an ISO 3166-2 code of the country, for example 'US-WA'. Required when country is 'US'; otherwise send an empty string to clear. Omit to leave unchanged. |
billToAddress.country |
string | no | The country, as an ISO 3166-1 alpha-2 code. Omit to leave unchanged. |
billToAddress.zipCode |
string | no | The postal or ZIP code. Must not be empty. Omit to leave unchanged. |
billToAddress.attention |
string | no | The person or department that mail to this address is for. Send an empty string to clear, omit to leave unchanged. |
soldToAddress |
object | no | Changes to the sold-to address. Must be omitted while sameAsBillToAddress is true. |
soldToAddress.line1 |
string | no | The first address line. Must not be empty. Omit to leave unchanged. |
soldToAddress.line2 |
string | no | The second address line. Send an empty string to clear, omit to leave unchanged. |
soldToAddress.city |
string | no | The city or locality. Must not be empty. Omit to leave unchanged. |
soldToAddress.stateProvince |
string | no | The state, province or region, as an ISO 3166-2 code of the country, for example 'US-WA'. Required when country is 'US'; otherwise send an empty string to clear. Omit to leave unchanged. |
soldToAddress.country |
string | no | The country, as an ISO 3166-1 alpha-2 code. Omit to leave unchanged. |
soldToAddress.zipCode |
string | no | The postal or ZIP code. Must not be empty. Omit to leave unchanged. |
soldToAddress.attention |
string | no | The person or department that mail to this address is for. Send an empty string to clear, omit to leave unchanged. |
createContacts |
array<object> | no | Contacts to add to the prospect. Each is a new contact, or an existing one linked by id. Example: [{"displayName":"Ravi Menon","emailAddress":"ravi.menon@northwind.example","isDefaultBillToContact":true}]. |
createContacts[].id |
string | no | An existing contact to link. It must not belong to another prospect. When set, send no other contact details. |
createContacts[].displayName |
string | no | The contact's display name. Required for a new contact. |
createContacts[].salutation |
string | no | The contact's form of address, for example 'Ms' or 'Dr'. |
createContacts[].firstName |
string | no | The contact's given name. |
createContacts[].middleName |
string | no | The contact's middle name or initial. |
createContacts[].lastName |
string | no | The contact's family name. |
createContacts[].suffix |
string | no | The contact's name suffix, for example 'Jr' or 'PhD'. |
createContacts[].emailAddress |
string | no | The email address the contact is reached at. Required for a new contact. When an existing contact has this address, that contact is linked instead of a new one, as in the app. |
createContacts[].workPhone |
string | no | The contact's work telephone number. |
createContacts[].isDefaultBillToContact |
boolean | no | Whether this is the default contact for the bill-to address. Defaults to false. |
createContacts[].isDefaultSoldToContact |
boolean | no | Whether this is the default contact for the sold-to address. Defaults to false. |
updateContacts |
array<object> | no | Changes to the role flags of contacts already on the prospect. Example: [{"id":"b8d6e5f2-7a01-4c49-8f36-5e1b4c0a9d72","isDefaultBillToContact":false}]. |
updateContacts[].id |
string | yes | The unique identifier for a contact of the prospect. |
updateContacts[].isDefaultBillToContact |
boolean | no | Whether this is the default contact for the bill-to address. Omit to leave unchanged. |
updateContacts[].isDefaultSoldToContact |
boolean | no | Whether this is the default contact for the sold-to address. Omit to leave unchanged. |
deleteContacts |
array<string> | no | The ids of contacts to remove from the prospect. The contact records are kept. |
{
"prospectName": "<prospectName>",
"entityId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"billingEmail": "invoices@northwind.example",
"crmId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"customerType": "default",
"defaultCurrency": "<defaultCurrency>",
"sameAsBillToAddress": true,
"billToAddress": {
"line1": "500 Terry Avenue North"
},
"soldToAddress": {
"line1": "<line1>",
"line2": "<line2>",
"city": "<city>",
"stateProvince": "<stateProvince>",
"country": "<country>",
"zipCode": "<zipCode>",
"attention": "<attention>"
},
"createContacts": [
{
"displayName": "Ravi Menon",
"emailAddress": "ravi.menon@northwind.example",
"isDefaultBillToContact": true
}
],
"updateContacts": [
{
"id": "b8d6e5f2-7a01-4c49-8f36-5e1b4c0a9d72",
"isDefaultBillToContact": false
}
],
"deleteContacts": [
"<deleteContacts>"
]
}
Response
200 Success
{
"data": {},
"diagnostics": [
{
"code": "<code>",
"message": "<message>",
"severity": "error",
"path": [
"<path>"
],
"details": "<details>"
}
]
}
Response headers
Idempotency-Replayed— Present andtrueonly when this response replays a previously stored one for the same Idempotency-Key, rather than reflecting a live execution. Absent on a live response - never sent asfalse.
Errors
| Code | Status |
|---|---|
NOT_FOUND |
400 |
PROSPECT_CONVERTED |
400 |
ENTITY_NOT_FOUND |
400 |
INVALID_PROSPECT_NAME |
400 |
INVALID_BILLING_EMAIL |
400 |
CURRENCY_NOT_FOUND |
400 |
INVALID_ADDRESS |
400 |
UNEXPECTED_SOLD_TO_ADDRESS |
400 |
CONTACT_NOT_FOUND |
400 |
INVALID_CONTACT |
400 |
CONTACT_DETAILS_WITH_ID |
400 |
DUPLICATE_CONTACT |
400 |
CONTACT_ALREADY_LINKED |
400 |
DUPLICATE_CONTACT_EMAIL |
400 |
DUPLICATE_DEFAULT_CONTACT |
400 |
IDEMPOTENCY_KEY_CONFLICT |
409 |
IDEMPOTENCY_PAYLOAD_MISMATCH |
422 |
Statuses
400— Invalid request or business failure. Codes: NOT_FOUND, PROSPECT_CONVERTED, ENTITY_NOT_FOUND, INVALID_PROSPECT_NAME, INVALID_BILLING_EMAIL, CURRENCY_NOT_FOUND, INVALID_ADDRESS, UNEXPECTED_SOLD_TO_ADDRESS, CONTACT_NOT_FOUND, INVALID_CONTACT, CONTACT_DETAILS_WITH_ID, DUPLICATE_CONTACT, CONTACT_ALREADY_LINKED, DUPLICATE_CONTACT_EMAIL, DUPLICATE_DEFAULT_CONTACT401— The request carries no valid access token.403— Not authorized404— Not found409— The Idempotency-Key is still being processed by another request.422— The Idempotency-Key was already used with a different request payload.429— Too many requests from this client address. The response has no body and noRetry-Afterheader.500— Internal server error