> ## 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 Order

> Use this endpoint to create an order.

Use this endpoint to **create or update** an order in your Reportana store. The `reference_id` attribute is required and must correspond to the `id` or unique identifier of the order in your system, ensuring proper association 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="number" type="string" required>
  Enter the order number.

  Example: "1234".
</ParamField>

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

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

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

  Example: "John Doe".
</ParamField>

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

  Example: "+5511911111111".
</ParamField>

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

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

<ParamField body="customer_document" type="string">
  Enter the customer’s document number.

  Example: "123456789".
</ParamField>

### Billing Adress

<ParamField body="billing_address" type="object" required>
  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: "90213".
  </ParamField>

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

    Example: -27.807915923881836
  </ParamField>

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

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

### Shipping Adress

<ParamField body="shipping_address" type="object" required>
  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[]" required>
  Click on "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 order.

    Example: 1
  </ParamField>

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

    Example: 49.9
  </ParamField>

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

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

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

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

  <ParamField body="tracking_number" type="string">
    Enter the product tracking number.

    Example: "LB123456789BR".
  </ParamField>
</ParamField>

### Payment & More Info

<ParamField body="currency" type="string" required>
  Enter the currency used.

  Example: "USD".
</ParamField>

<ParamField body="total_price" type="number" required>
  Enter the total amount.

  Example: 124.8
</ParamField>

<ParamField body="subtotal_price" type="number" required>
  Enter the subtotal amount.

  Example: 109.8
</ParamField>

<ParamField body="payment_status" type="string">
  Enter the payment status.

  Example: "PAID".

  Available options: `PAID`, `PENDING`, `NOT_PAID`.
</ParamField>

<ParamField body="payment_method" type="string">
  Enter the payment method.

  Example: "CREDIT\_CARD".

  Available options: `CREDIT_CARD`, `PIX`, `DEPOSIT`, `BOLETO`, `OTHER`.
</ParamField>

<ParamField body="tracking_numbers" type="string">
  Enter the order tracking numbers.

  Example: "LB123456789BR,LB987654321BR".
</ParamField>

<ParamField body="referring_site" type="string">
  Enter the site URL.

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

<ParamField body="status_url" type="string">
  Enter the order status URL.

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

<ParamField body="billet_url" type="string">
  Enter the payment URL.

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

<ParamField body="billet_line" type="string">
  Enter the billet barcode or Pix “Copy and Paste” string.
</ParamField>

<ParamField body="billet_expired_at" type="string">
  Enter the payment expiration date.

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

<ParamField body="original_created_at" type="string" required>
  Enter the order creation date.

  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."
      ],
      "original_created_at": [
        "The original_created_at field is required."
      ]
    }
  }
  ```
</ResponseExample>
