> ## Documentation Index
> Fetch the complete documentation index at: https://reportana.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Create/Update Abandoned Cart

> Use this endpoint to create an abandoned cart.

Use this **endpoint** to create or update an **abandoned cart** in your Reportana store. The `reference_id` attribute is **required** and must correspond to the `id` or the unique identifier of the abandoned cart in your system, ensuring proper synchronization between your system's data and our platform.

## Headers

<ParamField header="Authorization" type="string" required>
  Basic base64(client\_id + ':' + client\_secret)
</ParamField>

<ParamField header="Content-Type" type="string" required>
  Content-Type:application/json
</ParamField>

## Body

<ParamField body="reference_id" type="string" required>
  Enter the reference ID.

  Example: "123456789".
</ParamField>

<ParamField body="reason_type" type="string" required>
  Enter the reason for the abandoned cart.

  Example: null

  Available options: `DECLINED_CREDIT_CARD`, `null`.
</ParamField>

<ParamField body="number" type="string" required>
  Enter the abandoned cart number.

  Example: "1234".
</ParamField>

<ParamField body="admin_url" type="string">
  Enter the admin panel URL for accessing the abandoned cart.

  Example: "[https://example.com/admin/carts/123456789](https://example.com/admin/carts/123456789)".
</ParamField>

<ParamField body="customer_name" type="string" required>
  Enter the customer's name.

  Example: "John Doe".
</ParamField>

<ParamField body="customer_email" type="string" required>
  Enter the customer's email.

  Example: "[johndoe@gmail.com](mailto:johndoe@gmail.com)".
</ParamField>

<ParamField body="customer_phone" type="string" required>
  Enter the customer's phone number.

  Example: "+5511911111111".
</ParamField>

### Billing Adress

<ParamField body="billing_address" type="object">
  Enter the billing address information.

  <ParamField body="name" type="string">
    Enter the customer's name.

    Example: "John Doe".
  </ParamField>

  <ParamField body="first_name" type="string">
    Enter the customer's first name.

    Example: "John".
  </ParamField>

  <ParamField body="last_name" type="string">
    Enter the customer's last name.

    Example: "Doe".
  </ParamField>

  <ParamField body="company" type="string">
    Enter the company name.

    Example: "John Doe Ltda".
  </ParamField>

  <ParamField body="phone" type="string">
    Enter the customer's phone number.

    Example: "+5511911111111".
  </ParamField>

  <ParamField body="address1" type="string">
    Enter the customer's address.

    Example: "6925 Hollywood Blvd".
  </ParamField>

  <ParamField body="address2" type="string">
    Enter the customer's neighborhood.

    Example: "Times Square".
  </ParamField>

  <ParamField body="city" type="string">
    Enter the customer's city.

    Example: "New York".
  </ParamField>

  <ParamField body="province" type="string">
    Enter the customer's state.

    Example: "North Carolina".
  </ParamField>

  <ParamField body="province_code" type="string">
    Enter the customer's state code.

    Example: "NC".
  </ParamField>

  <ParamField body="country" type="string">
    Enter the customer's country.

    Example: "United States of America".
  </ParamField>

  <ParamField body="country_code" type="string">
    Enter the customer's country code.

    Example: "USA".
  </ParamField>

  <ParamField body="zip" type="string">
    Enter the customer's ZIP code.

    Example: "88508100".
  </ParamField>

  <ParamField body="latitude" type="string">
    Enter the customer's latitude.

    Example: -50.3183162423294
  </ParamField>

  <ParamField body="longitude" type="string">
    Enter the customer's longitude.

    Example: -27.807915923881836
  </ParamField>
</ParamField>

### Shipping Adress

<ParamField body="shipping_address" type="object">
  Enter the shipping address information.

  <ParamField body="name" type="string">
    Enter the customer's name.

    Example: "John Doe".
  </ParamField>

  <ParamField body="first_name" type="string">
    Enter the customer's first name.

    Example: "John".
  </ParamField>

  <ParamField body="last_name" type="string">
    Enter the customer's last name.

    Example: "Doe".
  </ParamField>

  <ParamField body="company" type="string">
    Enter the company name.

    Example: "John Doe Ltda".
  </ParamField>

  <ParamField body="phone" type="string">
    Enter the customer's phone number.

    Example: "+5511911111111".
  </ParamField>

  <ParamField body="address1" type="string">
    Enter the customer's address.

    Example: "6925 Hollywood Blvd".
  </ParamField>

  <ParamField body="address2" type="string">
    Enter the customer's neighborhood.

    Example: "Times Square".
  </ParamField>

  <ParamField body="city" type="string">
    Enter the customer's city.

    Example: "New York".
  </ParamField>

  <ParamField body="province" type="string">
    Enter the customer's state.

    Example: "North Carolina".
  </ParamField>

  <ParamField body="province_code" type="string">
    Enter the customer's state code.

    Example: "NC".
  </ParamField>

  <ParamField body="country" type="string">
    Enter the customer's country.

    Example: "United States of America".
  </ParamField>

  <ParamField body="country_code" type="string">
    Enter the customer's country code.

    Example: "USA".
  </ParamField>

  <ParamField body="zip" type="string">
    Enter the customer's ZIP code.

    Example: "88508100".
  </ParamField>

  <ParamField body="latitude" type="string">
    Enter the customer's latitude.

    Example: -27.807915923881836
  </ParamField>

  <ParamField body="longitude" type="string">
    Enter the customer's longitude.

    Example: -50.3183162423294
  </ParamField>
</ParamField>

### Line Items

<ParamField body="line_items" type="object[]">
  Click "Add an item" to add a product.

  <ParamField body="title" type="string">
    Enter the product title.

    Example: "Sunglasses".
  </ParamField>

  <ParamField body="variant_title" type="string">
    Enter the product variant title.

    Example: "Black".
  </ParamField>

  <ParamField body="quantity" type="number">
    Enter the quantity of products in the abandoned cart.

    Example: 1
  </ParamField>

  <ParamField body="price" type="number">
    Enter the product price.

    Example: 49.9
  </ParamField>

  <ParamField body="path" type="string">
    Enter the public URL of the product.

    Example: "[https://example.com/products/1234](https://example.com/products/1234)".
  </ParamField>

  <ParamField body="image_url" type="string">
    Enter the image URL of the product.

    Example: "[https://example.com/products/1234/image.jpg](https://example.com/products/1234/image.jpg)".
  </ParamField>
</ParamField>

### Checkout & More Info

<ParamField body="currency" type="string" required>
  Enter the currency of the abandoned cart.

  Example: "USD".
</ParamField>

<ParamField body="total_price" type="number" required>
  Enter the total value of the abandoned cart.

  Example: 124.8
</ParamField>

<ParamField body="subtotal_price" type="number" required>
  Enter the subtotal value of the abandoned cart.

  Example: 109.8
</ParamField>

<ParamField body="referring_site" type="string">
  Enter the URL of your website.

  Example: "[https://www.facebook.com/](https://www.facebook.com/)".
</ParamField>

<ParamField body="checkout_url" type="string">
  Enter the URL for the checkout link.

  Example: "[https://example.com/carts/123456789](https://example.com/carts/123456789)".
</ParamField>

<ParamField body="completed_at" type="string">
  Enter the date when the cart was completed.

  Example: "2022-05-31 23:59".
</ParamField>

<ParamField body="original_created_at" type="string" required>
  Enter the creation date of the abandoned cart.

  Example: "2022-05-27 12:00".
</ParamField>

<ResponseExample>
  ```json 200 theme={null}
  {
    "success": true,
    "data": null
  }
  ```

  ```json 4XX theme={null}
  {
    "success": false,
    "message": "Check the required fields.",
    "errors": {
      "reference_id": [
        "The reference_id field is required."
      ],
      "number": [
        "The number field is required."
      ],
      "customer_name": [
        "The customer_name field is required."
      ],
      "customer_email": [
        "The customer_email field is required."
      ],
      "customer_phone": [
        "The customer_phone field is required."
      ],
      "currency": [
        "The currency field is required."
      ],
      "total_price": [
        "The total_price field is required."
      ],
      "subtotal_price": [
        "The subtotal_price field is required."
      ],
      "checkout_url": [
        "The checkout_url field is required."
      ],
      "original_created_at": [
        "The original_created_at field is required."
      ]
    }
  }
  ```
</ResponseExample>
