# Create or Update a Customer

## createOrUpdateCustomer

<mark style="color:green;">`POST`</mark> `https://dcams.app/v3/stable/api/storage`

Send all of the required fields below and the method will detect whether a create or update is necessary and will signal in the return which one occurred.

#### Request Body

| Name                                      | Type   | Description                                 |
| ----------------------------------------- | ------ | ------------------------------------------- |
| user<mark style="color:red;">\*</mark>    | string | Your Veratad API Username                   |
| pass<mark style="color:red;">\*</mark>    | string | Your Veratad API Password                   |
| service<mark style="color:red;">\*</mark> | string | The service name "createOrUpdateCustomer"   |
| reference                                 | string | A value to be stored in the referecne field |
| target                                    | object | The target of the query                     |
| email                                     | string | The user's email address                    |
| fn                                        | string | The user's first name                       |
| ln                                        | string | The user's last name                        |
| addr                                      | string | The user's street address                   |
| city                                      | string | The user's city                             |
| state                                     | string | The user's state                            |
| zip                                       | string | The user's zip                              |
| dob                                       | string | The user's Date of Birth (YYYYMMDD)         |
| phone                                     | string | The user's phone number                     |
| documents                                 | object | The document images                         |
| front<mark style="color:red;">\*</mark>   | string | The front document image                    |
| back                                      | string | The back document image                     |

{% tabs %}
{% tab title="200 The customer was found" %}

```javascript
{
    "result": "Success",
    "reference": "888888812",
    "customer_link": "https://register.veratad.com/admin/customers.php?a=edit&id=727657",
    "status": "PASS",
    "type": "updateCustomer" // possible values "updateCustomer" or "createCustomer"
    "target": {
        "fn": "John",
        "ln": "Smith",
        "addr": "123 Main St",
        "city": "Stratford",
        "state": "CT",
        "zip": "06614",
        "dob": "19700101",
        "email": "jsmith@veratad.com",
        "phone": "2015106000"
    }
}
```

{% endtab %}

{% tab title="400 The email was not a valid email address" %}

```javascript
{
    "result": "Error",
    "message": "The email address is invalid"
}

//or

{
    "result": "Error",
    "message": "Missing a required input"
}
```

{% endtab %}

{% tab title="401 Either a bad username or password" %}

```javascript
{
    "result": "Error",
    "message": "Either your username or password is incorrect"
}
```

{% endtab %}

{% tab title="404 The customer was not found" %}

```javascript
{
    "result": "Error",
    "message": "The email address was not found"
}
```

{% endtab %}
{% endtabs %}

## Sample Request Body

```javascript
{
    "user": "USERNAME",
    "pass": "PASSWORD",
    "service": "createOrUpdateCustomer",
    "reference": "888888812"
    "target": {
        "email": "jsmith@veratad.com",
        "fn": "John",
        "ln": "Smith",
        "addr": "123 Main St",
        "city": "Stratford",
        "state": "CT",
        "zip": "06614",
        "dob": "19700101",
        "phone": "2015106000",
        "documents": {
            "front": "base64 encoded image",
            "back": "base64 encoded image"
        }
    }
}
```

## Response Fields

{% hint style="info" %}
The response will include all of the target attributes stored within the system for this user, except their document images, and the following varying fields.
{% endhint %}

| attribute | values                                                                      |
| --------- | --------------------------------------------------------------------------- |
| result    | <p><code>Success</code></p><p><code>Error</code></p>                        |
| status    | <p><code>PASS</code></p><p><code>PENDING</code></p><p><code>FAIL</code></p> |
| type      | <p><code>updateCustomer</code></p><p><code>createCustomer</code></p>        |


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://api.veratad.com/id-document-verification/overview/id-document-storage/create-or-update-customer.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
