# createCustomer

Mutation · GraphQL API

Create a customer for storing individual customer information and/or grouping transactions and multi-use payment methods.

## Authentication

- SERVER

## Input

- `input` (`CreateCustomerInput`)

## Returns [CreateCustomerPayload](/braintree/graphql/reference/types/create-customer-payload)

Top-level fields returned when creating a customer.

### Returned fields

- `clientMutationId` (`String`): An identifier used to reconcile requests and responses. 255 characters maximum.
- `customer` (`Customer`): Information about the customer that was created. Can be used when vaulting payment methods or creating transactions to associate those objects.

## Examples

### Create customer

Top-level field for creating a customer.

```graphql
mutation createCustomer($input: CreateCustomerInput) {
  createCustomer(input: $input) {
    clientMutationId
    customer {
      __typename
      id
      legacyId
      company
      createdAt
      customFields {
        name
        value
      }
      defaultPaymentMethod {
        __typename
        id
        legacyId
      }
      email
      firstName
      lastName
      phoneNumber
      fax
      website
    }
  }
}
```

### Create a customer with no variables

Calls createCustomer without passing any variables at all. The input parameter is optional so this is valid.


```graphql
mutation createCustomer($input: CreateCustomerInput) {
  createCustomer(input: $input) {
    clientMutationId
    customer {
      id
      legacyId
    }
  }
}
```

#### Variables

```json
{}
```

#### Response

```json
{
  "data": {
    "createCustomer": {
      "customer": {
        "id": "Y3VzdG9tZXJfYWJj",
        "legacyId": "customer_abc"
      }
    }
  },
  "extensions": {
    "requestId": "create-no-vars-request-id"
  }
}
```

### Create a customer with null input

Explicitly passes null for the input parameter. This sends null to the API, which is different from omitting it entirely.


```graphql
mutation createCustomer($input: CreateCustomerInput) {
  createCustomer(input: $input) {
    clientMutationId
    customer {
      id
      legacyId
    }
  }
}
```

#### Variables

```json
{
  "input": null
}
```

#### Response

```json
{
  "data": {
    "createCustomer": {
      "customer": {
        "id": "Y3VzdG9tZXJfZGVm",
        "legacyId": "customer_def"
      }
    }
  },
  "extensions": {
    "requestId": "create-null-request-id"
  }
}
```

### Create a customer with empty input

Passes an empty object for the input parameter. The input is present but contains no fields.


```graphql
mutation createCustomer($input: CreateCustomerInput) {
  createCustomer(input: $input) {
    clientMutationId
    customer {
      id
      legacyId
    }
  }
}
```

#### Variables

```json
{
  "input": {}
}
```

#### Response

```json
{
  "data": {
    "createCustomer": {
      "customer": {
        "id": "Y3VzdG9tZXJfZ2hp",
        "legacyId": "customer_ghi"
      }
    }
  },
  "extensions": {
    "requestId": "create-empty-request-id"
  }
}
```

---

[View the complete GraphQL schema on GitHub](https://raw.githubusercontent.com/braintree/graphql-api/refs/heads/master/schema.graphql)