---
title: Editing a Customer
slug: devdocs/editing-a-customer
docTags: 
createdAt: 2026-10-16T12:03:52.020Z
---

Every mutation on this page returns `result`, `errorCode`, `errorMessage` and `errorData`. Check `errorCode` after each call. See **Errors & Troubleshooting**.

## Update a customer

Send the `publicKey` of the customer and only the fields you want to change.

**Query**

```graphql
mutation UpdateCustomer($payload: CustomerUpdateInputType!) {
  customer {
    update(payload: $payload) {
      result {
        publicKey
        firstName
        lastName
        email
        category { publicKey name }
      }
      errorCode
      errorMessage
      errorData
    }
  }
}
```

**Variables**

```json
{
  "payload": {
    "publicKey": "<customer key>",
    "email": "jane.doe@example.com",
    "category": "<customer category key>"
  }
}
```

**cURL**

```bash
curl --location 'https://sandbox.expressoft.eu/connect/api/interopgql' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer <token>' \
--data '{"query": "mutation UpdateCustomer($payload: CustomerUpdateInputType!) { customer { update(payload: $payload) { result { publicKey firstName lastName email category { publicKey name } } errorCode errorMessage errorData } } }", "variables": {"payload": {"publicKey": "<customer key>", "email": "jane.doe@example.com", "category": "<customer category key>"}}}'
```

**Response**

```json
{
  "data": {
    "customer": {
      "update": {
        "result": {
          "publicKey": "00000000-0000-0000-0000-000000000001",
          "firstName": "Jane",
          "lastName": "Doe",
          "email": "jane.doe@example.com",
          "category": {
            "publicKey": "00000000-0000-0000-0000-000000000010",
            "name": "Gold customers"
          }
        },
        "errorCode": null,
        "errorMessage": null,
        "errorData": null
      }
    }
  }
}
```

| Field         | Type       | Required | Default                                  | Description                         |
| ------------- | ---------- | -------- | ---------------------------------------- | ----------------------------------- |
| `publicKey`   | `Guid!`    | yes      |                                          | Customer public key.                |
| `category`    | `Guid`     | no       | `"00000000-0000-0000-0000-000000000000"` | Customer category key (optional).   |
| `firstName`   | `String`   | no       | `" "`                                    | Customer first name (optional).     |
| `lastName`    | `String`   | no       | `" "`                                    | Customer last name (optional).      |
| `code`        | `String`   | no       | `" "`                                    | Customer code/reference (optional). |
| `email`       | `String`   | no       | `" "`                                    | Customer email (optional).          |
| `mobilePhone` | `String`   | no       | `" "`                                    | Mobile phone (optional).            |
| `workPhone`   | `String`   | no       | `" "`                                    | Work phone (optional).              |
| `homePhone`   | `String`   | no       | `" "`                                    | Home phone (optional).              |
| `birthDate`   | `DateTime` | no       | `"0001-01-01T00:00:00"`                  | Customer date of birth (optional).  |

## Delete a customer

The customer is deleted softly: it becomes inactive and doesn't appear in the default lists.

**Query**

```graphql
mutation DeleteCustomer($customer: Guid!) {
  customer {
    delete(payload: $customer) {
      result
      errorCode
      errorMessage
      errorData
    }
  }
}
```

**Variables**

```json
{
  "customer": "<customer key>"
}
```

**cURL**

```bash
curl --location 'https://sandbox.expressoft.eu/connect/api/interopgql' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer <token>' \
--data '{"query": "mutation DeleteCustomer($customer: Guid!) { customer { delete(payload: $customer) { result errorCode errorMessage errorData } } }", "variables": {"customer": "<customer key>"}}'
```

**Response**

```json
{
  "data": {
    "customer": {
      "delete": {
        "result": true,
        "errorCode": null,
        "errorMessage": null,
        "errorData": null
      }
    }
  }
}
```

## Manage addresses

Create an address with `customer.createAddress`. The mutation and its fields are in **Place Order** (step 3) of the Delivery API.

Update an address with `customer.updateCustomerAddress`. Send the `publicKey` of the **address** and the fields to change.

**Query**

```graphql
mutation UpdateCustomerAddress($payload: CustomerAddressUpdateInputType!) {
  customer {
    updateCustomerAddress(payload: $payload) {
      result {
        publicKey
        streetName
        streetNumber
        floor
        landmark
      }
      errorCode
      errorMessage
      errorData
    }
  }
}
```

**Variables**

```json
{
  "payload": {
    "publicKey": "<address key>",
    "floor": "2",
    "landmark": "Ring the bell twice"
  }
}
```

**cURL**

```bash
curl --location 'https://sandbox.expressoft.eu/connect/api/interopgql' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer <token>' \
--data '{"query": "mutation UpdateCustomerAddress($payload: CustomerAddressUpdateInputType!) { customer { updateCustomerAddress(payload: $payload) { result { publicKey streetName streetNumber floor landmark } errorCode errorMessage errorData } } }", "variables": {"payload": {"publicKey": "<address key>", "floor": "2", "landmark": "Ring the bell twice"}}}'
```

**Response**

```json
{
  "data": {
    "customer": {
      "updateCustomerAddress": {
        "result": {
          "publicKey": "00000000-0000-0000-0000-000000000011",
          "streetName": "Sample Street",
          "streetNumber": "12",
          "floor": "2",
          "landmark": "Ring the bell twice"
        },
        "errorCode": null,
        "errorMessage": null,
        "errorData": null
      }
    }
  }
}
```

| Field            | Type                   | Required | Default                                  | Description                     |
| ---------------- | ---------------------- | -------- | ---------------------------------------- | ------------------------------- |
| `publicKey`      | `Guid!`                | yes      |                                          | Address public key.             |
| `streetKey`      | `Guid`                 | no       | `"00000000-0000-0000-0000-000000000000"` | Street public key (optional).   |
| `streetNumber`   | `String`               | no       | `" "`                                    | Street number (optional).       |
| `buildingNumber` | `String`               | no       | `" "`                                    | Building number (optional).     |
| `staircase`      | `String`               | no       | `" "`                                    | Staircase (optional).           |
| `floor`          | `String`               | no       | `" "`                                    | Floor (optional).               |
| `roomNumber`     | `String`               | no       | `" "`                                    | Room number (optional).         |
| `intercom`       | `String`               | no       | `" "`                                    | Intercom (optional).            |
| `landmark`       | `String`               | no       | `" "`                                    | Landmark (optional).            |
| `geoLocation`    | `GeoLocationInputType` | no       |                                          | Latitude/Longitude coordinates. |

Delete an address with `customer.deleteAddress`. It takes the address key and returns a boolean, like **Delete a customer**.

## Link a customer to a company

For B2B customers, link the customer to a company with `customer.linkCompany`. Use `customer.unlinkCompany` with the same input to remove the link.

**Query**

```graphql
mutation LinkCompany($payload: CustomerCompanyLinkInputType!) {
  customer {
    linkCompany(payload: $payload) {
      result {
        publicKey
        companies {
          company { publicKey name }
        }
      }
      errorCode
      errorMessage
      errorData
    }
  }
}
```

**Variables**

```json
{
  "payload": {
    "customerKey": "<customer key>",
    "companyKey": "<company key>"
  }
}
```

**cURL**

```bash
curl --location 'https://sandbox.expressoft.eu/connect/api/interopgql' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer <token>' \
--data '{"query": "mutation LinkCompany($payload: CustomerCompanyLinkInputType!) { customer { linkCompany(payload: $payload) { result { publicKey companies { company { publicKey name } } } errorCode errorMessage errorData } } }", "variables": {"payload": {"customerKey": "<customer key>", "companyKey": "<company key>"}}}'
```

**Response**

```json
{
  "data": {
    "customer": {
      "linkCompany": {
        "result": {
          "publicKey": "00000000-0000-0000-0000-000000000001",
          "companies": [
            {
              "company": {
                "publicKey": "00000000-0000-0000-0000-000000000101",
                "name": "Example Company SRL"
              }
            }
          ]
        },
        "errorCode": null,
        "errorMessage": null,
        "errorData": null
      }
    }
  }
}
```

