Skip to main content
PUT
/
v1
/
sales
/
{id}
Update a sale
curl --request PUT \
  --url https://dev.flextell.ai/api/v1/sales/{id} \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --header 'X-Tenant: <x-tenant>' \
  --data '
{
  "customer_id": 123,
  "appointment_id": 123,
  "currency_id": 123,
  "exchange_rate": 1,
  "user_id": 123,
  "notes": "<string>",
  "items": [
    {
      "staff_id": 123,
      "itemable_id": 2,
      "quantity": 1.0001,
      "unit_price": 1,
      "discount_amount": 1,
      "discount_percentage": 50,
      "sub_total": 1,
      "total_discount": 1,
      "total_tax": 1,
      "total_price": 1,
      "cost_price": 1,
      "warehouse_id": 123,
      "order": 1
    }
  ]
}
'
{
  "success": "<string>",
  "data": {
    "id": 123,
    "tenant_id": 123,
    "user_id": 123,
    "customer_id": 123,
    "appointment_id": 123,
    "currency_id": 123,
    "exchange_rate": 123,
    "notes": "<string>",
    "status": "<string>",
    "total_price": 123,
    "remaining_balance": 123,
    "created_at": "2023-11-07T05:31:56Z",
    "updated_at": "2023-11-07T05:31:56Z",
    "deleted_at": "2023-11-07T05:31:56Z",
    "customer": {
      "id": 123,
      "first_name": "<string>",
      "last_name": "<string>",
      "phone_number": "<string>",
      "email": "<string>"
    },
    "user": {
      "id": 123,
      "name": "<string>"
    },
    "currency": {
      "id": 123,
      "code": "<string>",
      "symbol": "<string>",
      "name": "<string>"
    },
    "items": [
      {
        "id": 123,
        "sale_id": 123,
        "staff_id": 123,
        "order": 123,
        "itemable_type": "<string>",
        "itemable_id": 123,
        "warehouse_id": 123,
        "quantity": 123,
        "tax_rate": 123,
        "unit_price": 123,
        "cost_price": 123,
        "discount_amount": 123,
        "discount_percentage": 123,
        "sub_total": 123,
        "total_discount": 123,
        "total_tax": 123,
        "total_price": 123,
        "staff": {
          "id": 123,
          "name": "<string>"
        },
        "itemable": {
          "id": "<string>",
          "name": "<string>"
        }
      }
    ]
  }
}

Authorizations

Authorization
string
header
required

The access token received from the authorization server in the OAuth 2.0 flow.

Headers

X-Tenant
number
required

Tenant identifier. Send the Tenant ID in the X-Tenant header to scope API requests to a specific tenant.

Path Parameters

id
integer
required

The sale identifier

Body

application/json
customer_id
integer

Filter by customer ID.

appointment_id
integer | null

The appointment ID.

currency_id
integer

Filter by currency ID.

exchange_rate
number

Currency exchange rate.

Required range: x >= 0
status
enum<string>

Filter by status.

Available options:
draft,
completed,
cancelled,
invoiced,
pending
user_id
integer | null

Filter by user ID.

notes
string | null

Internal notes.

Maximum string length: 65535
items
object[]

List of items.

Minimum array length: 1

Response

success
string
required
data
SaleResource · object
required