---
updatedAt: 2026-05-20T09:36:41.000Z
agentTools:
  projectIndex: https://dev.gotom.io/llms.txt
---

# Create or update (Upsert) a customer with addresses and contact persons. This endpoint needs to be enabled by goTom for it to work.

# OpenAPI definition

```json
{
  "openapi": "3.0.0",
  "info": {
    "version": "4.4.12",
    "title": "Customer API"
  },
  "x-explorer-enabled": false,
  "paths": {
    "/app-api/crm-sync-import-external-crm-id/update-customer": {
      "post": {
        "tags": [
          "Customer"
        ],
        "summary": "Create or update (Upsert) a customer with addresses and contact persons. This endpoint needs to be enabled by goTom for it to work.",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/Customer"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Customer was created / updated",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/UpdateCustomerResponse"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "errorLogs": {
                          "type": "object",
                          "example": null
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "202": {
            "description": "Customer has not been processed yet (check /error-logs/ endpoint for status)",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "type": "object",
                      "properties": {
                        "jobId": {
                          "example": 123
                        },
                        "jobAlreadyFinished": {
                          "example": false
                        },
                        "reason": {
                          "example": "blocking_timeout"
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "description": "There was an issue with updating the customer",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/UpdateCustomerResponse"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "error": {
                          "type": "object",
                          "properties": {
                            "msg": {
                              "description": "If the customer data fails validation before further processing e.g. is more severely badly formatted like no data or customer sent at all or invalid JSON format.",
                              "type": "string",
                              "example": "Request had no body"
                            }
                          }
                        },
                        "reason": {
                          "description": "Indication of what is the status of the processed job.  'data_error' means there was an error when processing data, please check logs. 'blocking_timeout' means job couldn't be processed before returning response. 'blocking_buried' and 'queue_internal' are more severe internal errors.",
                          "enum": [
                            "data_error",
                            "blocking_timeout",
                            "blocking_buried",
                            "queue_internal"
                          ],
                          "type": "string",
                          "example": "data_error"
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "UpdateCustomerResponse": {
        "description": "Response for successful, failed and unfinished customer update jobs.",
        "allOf": [
          {
            "type": "object",
            "properties": {
              "jobId": {
                "description": "The job id. Currently this id can reset upon reboot of the server e.g. is not necessarily unique.",
                "type": "integer",
                "example": 123
              },
              "jobAlreadyFinished": {
                "description": "Whether or not the job was able to return synchronously e.g. if true means the job was processed before the response was returned and thus the logs are returned as well in the response. False means the job still awaits processing.",
                "type": "boolean",
                "example": true
              }
            }
          },
          {
            "$ref": "#/components/schemas/CrmSyncErrorLogsMixin"
          }
        ]
      },
      "CrmSyncErrorLogsMixin": {
        "description": "used internally to keep DRY",
        "type": "object",
        "properties": {
          "errorLogs": {
            "type": "object",
            "nullable": true,
            "properties": {
              "api_error": {
                "description": "The logs that show what lead to an error when processing the request e.g. missing externalCrmId on data.",
                "type": "string",
                "example": "Class AppBundle\\Entity\\CustomerAddress expects the key externalCrmId to be present in data. Only \"title,firm,softDeleted,externalId\" received"
              }
            }
          },
          "warningLogs": {
            "description": "The log that shows what lead to a warning when processing the request e.g. providing not all possible fields with their values or providing fields with values that are not configured and thus not read.",
            "nullable": true,
            "type": "array",
            "example": [
              "Data key contactPersons provided for type AppBundle\\Entity\\Customer, but is not a configured attribute. contactPersons will be ignored. Let the client know, that this attribute should be removed from his request.",
              "Data key id not provided for type AppBundle\\Entity\\Customer, but is a configured attribute. Did the client forget to send it?"
            ],
            "items": {
              "type": "string"
            }
          }
        }
      },
      "Customer": {
        "properties": {
          "customer": {
            "description": "Customer Object",
            "type": "object",
            "required": [
              "externalCrmId",
              "firm",
              "status",
              "statusEc",
              "language",
              "mainAddress"
            ],
            "properties": {
              "externalCrmId": {
                "description": "External CRM Id for referencing the customer, the important ID of the CRM sync API.",
                "type": "string"
              },
              "externalId": {
                "description": "Not to be confused with externalCrmId, externalId is not important for the CRM sync API. It could be used to reference again something else.",
                "type": "string"
              },
              "firm": {
                "description": "Name of the customer",
                "type": "string"
              },
              "mwst": {
                "description": "VAT Number",
                "type": "string"
              },
              "note": {
                "description": "Note on the client",
                "type": "string"
              },
              "status": {
                "description": "States if the customer is active or inactive. 1 = active, 0 = inactive",
                "type": "integer",
                "enum": [
                  1,
                  0
                ]
              },
              "statusEc": {
                "description": "Customer type. 1 = Customer, 2 = Intermediator, 3 = Agency, 5 = Publisher (Only available with marketer module activated)",
                "type": "integer",
                "enum": [
                  1,
                  2,
                  3,
                  5
                ]
              },
              "pipelineStatus": {
                "description": "Pipeline statuses depend on a type (e.g. contact, or customer) and cannot be shared between types. A pipeline status can help to process leads and/or contacts and divide them into individual stages. The pipeline status is defined in the CRM Part of Admin Center.",
                "type": "object",
                "nullable": true,
                "additionalProperties": false,
                "required": [
                  "externalCrmId"
                ],
                "properties": {
                  "externalCrmId": {
                    "description": "This refers to the pipeline externalCrmId defined in admin center.",
                    "type": "string"
                  }
                }
              },
              "language": {
                "description": "Preferred language for this customer",
                "type": "string",
                "enum": [
                  "de",
                  "en",
                  "fr",
                  "it"
                ]
              },
              "bankAccountNumber": {
                "description": "Bank Account Number for this customer",
                "type": "string"
              },
              "bankIBANNumber": {
                "description": "IBAN for this customer",
                "type": "string"
              },
              "bankClearingNumber": {
                "description": "Bank Clearing for this customer",
                "type": "string"
              },
              "bankName": {
                "description": "Bank name for this customer",
                "type": "string"
              },
              "searchstring": {
                "description": "Search help to find this customer easier with other name(s)",
                "type": "string"
              },
              "vatType": {
                "description": "VAT Type (0 = Standard, 2 = VAT exempt, 3 = VAT reduced, 7 = VAT exempt embassy)",
                "type": "integer",
                "default": 0,
                "enum": [
                  0,
                  2,
                  3,
                  7
                ]
              },
              "softDeleted": {
                "description": "If this customer should be treated as deleted.",
                "example": false,
                "type": "boolean",
                "default": false
              },
              "commission": {
                "description": "Defines the default commissions for an agency or intermediator. Has no effect on statusEc != 2 or 3.",
                "type": "object",
                "required": [
                  "bkCommission",
                  "vmkCommission",
                  "type"
                ],
                "properties": {
                  "bkCommission": {
                    "description": "Agency Commission aka BK (Beraterkommission) aka AP (Agenturprovision) in percent",
                    "type": "number"
                  },
                  "vmkCommission": {
                    "description": "Intermediator Commission aka VMK (Vermittlerkommission) aka DBE (Direktbuchungsentschädigung) aka 2. Provision aka 2. Agentur-Provision in percent",
                    "type": "number"
                  },
                  "type": {
                    "description": "Type of commission. \n0 = Standard (default) = bkCommission direct / vmkCommission direct\n2 = bkCommission direct / vmkCommission indirect (Accrual / Rückstellung)\n3 = bkCommission separate / vmkCommission indirect (Accrual / Rückstellung)\n4 = vmkCommission separate\n",
                    "type": "integer",
                    "enum": [
                      0,
                      2,
                      3,
                      4
                    ]
                  }
                }
              },
              "industry": {
                "description": "Customer industry",
                "type": "object",
                "required": [
                  "externalCrmId"
                ],
                "properties": {
                  "externalCrmId": {
                    "description": "External CRM Id for referencing the industry",
                    "type": "string"
                  },
                  "name": {
                    "description": "Name of the industry. Will update the industry name for every customer that uses the same industry.",
                    "type": "string"
                  }
                }
              },
              "addresses": {
                "description": "Customer addresses. Addresses added through this endpoint are merged with existing ones (upsert). Deleting existing addresses is not supported.",
                "type": "array",
                "items": {
                  "type": "object",
                  "required": [
                    "externalCrmId",
                    "title",
                    "firm",
                    "zip",
                    "place",
                    "country"
                  ],
                  "properties": {
                    "externalCrmId": {
                      "description": "External CRM Id for referencing the address",
                      "type": "string"
                    },
                    "title": {
                      "description": "Name/Label",
                      "type": "string"
                    },
                    "firm": {
                      "description": "Company",
                      "type": "string"
                    },
                    "department": {
                      "description": "Departement",
                      "type": "string"
                    },
                    "street": {
                      "description": "Street",
                      "type": "string"
                    },
                    "number": {
                      "description": "Street number",
                      "type": "string"
                    },
                    "addresstext": {
                      "description": "Addition",
                      "type": "string"
                    },
                    "zip": {
                      "description": "Zip code",
                      "type": "string"
                    },
                    "place": {
                      "description": "City/Place",
                      "type": "string"
                    },
                    "country": {
                      "description": "Country (ISO 3166-1 alpha-2 Code) like \"CH\" / \"DE\" / \"AT\"\nhttps://en.wikipedia.org/wiki/ISO_3166-1_alpha-2\n",
                      "type": "string"
                    },
                    "externalId": {
                      "description": "External Id",
                      "type": "integer"
                    },
                    "sendingRule": {
                      "description": "Invoice sending rule. Default is defined via admin center setting",
                      "type": "string",
                      "enum": [
                        "email",
                        "post"
                      ]
                    },
                    "sendingRuleAddresses": {
                      "description": "E-Mail addresses for invoice sending. Only useful with sendingRule \"email\".",
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "softDeleted": {
                      "description": "If this address should be treated as deleted.",
                      "example": false,
                      "type": "boolean",
                      "default": false
                    }
                  }
                }
              },
              "mainAddress": {
                "description": "Reference to the main address for this customer",
                "type": "object",
                "required": [
                  "externalCrmId"
                ],
                "properties": {
                  "externalCrmId": {
                    "description": "External CRM Id for referencing the address. If a record with this externalCrmId does not exist, an empty one will be created.",
                    "type": "string"
                  }
                }
              },
              "contacts": {
                "description": "Customer contacts. Contacts added through this endpoint are merged with existing ones (upsert). Deleting existing contacts is not supported, as they may already be referenced elsewhere, which could cause errors. This functionality replaces the deprecated <s>contactPersons</s> property.",
                "type": "array",
                "items": {
                  "type": "object",
                  "required": [
                    "externalCrmId",
                    "peopleGender",
                    "peopleLastname",
                    "peopleName"
                  ],
                  "properties": {
                    "externalCrmId": {
                      "description": "External CRM Id for referencing the contact",
                      "type": "string"
                    },
                    "peopleGender": {
                      "description": "Gender. \"M\" = male, \"F\" = female, \"D\" = divers",
                      "type": "string",
                      "enum": [
                        "M",
                        "F",
                        "D"
                      ]
                    },
                    "peopleLastname": {
                      "description": "Lastname",
                      "type": "string"
                    },
                    "peopleName": {
                      "description": "Surname",
                      "type": "string"
                    },
                    "peoplePhone": {
                      "description": "Phone Number",
                      "type": "string"
                    },
                    "peopleNatel": {
                      "description": "Mobile Number",
                      "type": "string"
                    },
                    "peopleEmail": {
                      "description": "E-Mail",
                      "type": "string"
                    },
                    "peopleStatus": {
                      "description": "Status active/inactive. \"A\" = active. \"N\" = not active.",
                      "type": "string",
                      "default": "A",
                      "enum": [
                        "A",
                        "N"
                      ]
                    },
                    "lead": {
                      "description": "Mark contact as lead. \n* `true`: contact is marked as lead. \n* `false`: contact is not marked as lead.\n",
                      "type": "boolean",
                      "default": false
                    },
                    "jobFunctions": {
                      "description": "This is an array of objects for historic reasons, but only 1 object is supported with lang 'de'. So only send one job function in lang 'de'.",
                      "type": "array",
                      "items": {
                        "type": "object",
                        "required": [
                          "lang",
                          "function"
                        ],
                        "properties": {
                          "lang": {
                            "description": "Language in which the function is saved (deprecated). Use \"de\" always",
                            "type": "string",
                            "enum": [
                              "de"
                            ]
                          },
                          "function": {
                            "description": "The function name",
                            "type": "string"
                          }
                        }
                      }
                    },
                    "pipelineStatus": {
                      "description": "Pipeline statuses are statuses that are created individually and can be assigned to a contact. A pipeline status can help to process leads and/or contacts and divide them into individual stages. If set to null, will remove the pipeline status from the contact. The pipeline status is defined in the CRM Part of Admin Center.",
                      "type": "object",
                      "nullable": true,
                      "properties": {
                        "externalCrmId": {
                          "description": "This refers to the pipeline externalCrmId defined in admin center, an incorrect externalCrmId will trigger a warning message, and ignore the pipelineStatus entry.",
                          "type": "string"
                        }
                      }
                    }
                  }
                }
              },
              "tags": {
                "description": "Customer tags",
                "type": "array",
                "items": {
                  "type": "object",
                  "required": [
                    "externalCrmId"
                  ],
                  "properties": {
                    "externalCrmId": {
                      "description": "External CRM Id for referencing the tag",
                      "type": "string"
                    },
                    "name": {
                      "description": "Name of the tag (if this property is set, it will update the name of the tag for every customer)",
                      "type": "string"
                    }
                  }
                }
              },
              "references": {
                "description": "Customer references",
                "type": "array",
                "items": {
                  "type": "object",
                  "required": [
                    "externalCrmId"
                  ],
                  "properties": {
                    "externalCrmId": {
                      "description": "External CRM Id for referencing the customer reference",
                      "type": "string"
                    },
                    "referenceType": {
                      "description": "Type of the reference",
                      "type": "string"
                    },
                    "referenceValue": {
                      "description": "Value of the reference",
                      "type": "string"
                    }
                  }
                }
              },
              "consultants": {
                "description": "Customer consultants. Cannot be set to empty/null, will only update if a consultant email is provided.",
                "type": "array",
                "items": {
                  "type": "object",
                  "required": [
                    "email"
                  ],
                  "properties": {
                    "email": {
                      "description": "E-Mail address of consultant",
                      "type": "string"
                    }
                  }
                }
              },
              "paymentTerm": {
                "description": "Payment term for customer",
                "type": "object",
                "required": [
                  "externalCrmId"
                ],
                "properties": {
                  "externalCrmId": {
                    "description": "External CRM Id for referencing the payment term",
                    "type": "string"
                  },
                  "days": {
                    "description": "Amount of days until the invoice has to be paid",
                    "type": "integer"
                  },
                  "name": {
                    "description": "Name of the payment term",
                    "type": "string"
                  },
                  "cashDiscountDays": {
                    "description": "How many days that a cash discount (skonto) can be applied",
                    "type": "integer"
                  },
                  "cashDiscountPercent": {
                    "description": "Percentage of cash discount (skonto) that can be applied",
                    "type": "number"
                  },
                  "billingPhrases": {
                    "description": "Text to print on invoice in different languages",
                    "type": "object",
                    "properties": {
                      "de": {
                        "description": "German text",
                        "type": "string"
                      },
                      "en": {
                        "description": "English text",
                        "type": "string"
                      },
                      "fr": {
                        "description": "French text",
                        "type": "string"
                      },
                      "it": {
                        "description": "Italian text",
                        "type": "string"
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}
```