biterp

Approve quote

In a single transaction, marks a `pending` quote as `approved` and creates a sales order in `draft` from it, with `quote_id` pointing to the quote and the quote items copied. Returns both. Requires `quotes.update` and `sales-orders.create`.

POST
/quotes/{id}/approve
AuthorizationBearer <token>

In: header

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/json

application/json

application/json

application/json

application/json

application/json

curl -X POST "https://api.biterp.ai/quotes/{id}/approve" \  -H "Content-Type: application/json" \  -d '{}'
{
  "quote": {
    "id": "string",
    "record_number": 0,
    "reference_code": "string",
    "product_type": "goods",
    "status": "pending",
    "customer_id": "string",
    "quote_date": "2019-08-24",
    "valid_until": "2019-08-24",
    "salesperson_name": "string",
    "estimated_delivery_date": "2019-08-24",
    "description": "string",
    "subtotal": "1500.000000",
    "discount_amount": "0.000000",
    "discount_rate": "10.000000",
    "total_discount": "0.000000",
    "total": "1500.000000",
    "metadata": {},
    "created_at": "2019-08-24T14:15:22Z",
    "updated_at": "2019-08-24T14:15:22Z",
    "deleted_at": "2019-08-24T14:15:22Z",
    "customer": {},
    "items": [
      {
        "id": "string",
        "quote_id": "string",
        "item_description": "string",
        "product_id": "string",
        "quantity": "2.000000",
        "unit_price": "100.000000",
        "discount_amount": "0.000000",
        "subtotal": "200.000000",
        "total": "200.000000",
        "position": 0,
        "created_at": "2019-08-24T14:15:22Z",
        "updated_at": "2019-08-24T14:15:22Z",
        "deleted_at": "2019-08-24T14:15:22Z",
        "product": {
          "id": "string",
          "record_number": 0,
          "reference_code": "string",
          "name": "string",
          "description": "string",
          "tags": [
            "string"
          ],
          "type": "goods",
          "sale_price": "99.900000",
          "image_url": "string",
          "is_blocked": true,
          "metadata": {},
          "unit_of_measurement_id": "4e07c0f9-efdb-49c6-a977-aed0b75f3157",
          "unit_of_measurement": {
            "id": "string",
            "code": "string",
            "symbol": "string",
            "fiscal_codes": {
              "property1": "string",
              "property2": "string"
            },
            "country_codes": [
              "string"
            ],
            "titles": {
              "property1": "string",
              "property2": "string"
            },
            "descriptions": {
              "property1": "string",
              "property2": "string"
            },
            "is_blocked": true,
            "display_order": 0,
            "created_at": "2019-08-24T14:15:22Z",
            "updated_at": "2019-08-24T14:15:22Z"
          },
          "br_data": {
            "ncm_code": "string",
            "cest_code": "string",
            "federal_service_code": "string",
            "city_service_code": "string",
            "nbs_code": "string",
            "taxation_type": "taxation_in_municipality",
            "cnae_code": "string",
            "ibs_cbs_cst": "string",
            "ibs_cbs_classification": "string",
            "ibs_cbs_operation_indicator_code": "string",
            "ibs_cbs_is_personal_use": true,
            "origin": "string",
            "extipi": "string"
          },
          "us_data": {
            "hts_code": "string",
            "schedule_b_code": "string",
            "eccn_code": "string",
            "tax_code": "string",
            "sales_tax_category": "string",
            "country_of_origin": "string",
            "upc_code": "string"
          },
          "created_at": "2019-08-24T14:15:22Z",
          "updated_at": "2019-08-24T14:15:22Z",
          "deleted_at": "2019-08-24T14:15:22Z"
        }
      }
    ]
  },
  "sales_order": {
    "id": "string",
    "record_number": 0,
    "reference_code": "string",
    "operation_type": "sale",
    "product_type": "goods",
    "status": "draft",
    "order_date": "2019-08-24",
    "delivery_date": "2019-08-24",
    "customer_id": "string",
    "quote_id": "3c071a1d-db86-46a7-9dc8-72ba3fbca992",
    "invoice_id": "f4c4edb8-11e0-4b33-bcc1-482dc59ebb32",
    "salesperson_name": "string",
    "description": "string",
    "notes": "string",
    "subtotal": "1500.000000",
    "items_discount": "0.000000",
    "discount_amount": "0.000000",
    "discount_rate": "10.000000",
    "total_discount": "0.000000",
    "total": "1500.000000",
    "metadata": {},
    "br_data": {
      "taxation_type": "string"
    },
    "created_at": "2019-08-24T14:15:22Z",
    "updated_at": "2019-08-24T14:15:22Z",
    "deleted_at": "2019-08-24T14:15:22Z",
    "pending_receivables": [
      {}
    ],
    "customer": {},
    "quote": {
      "id": "string",
      "record_number": 0,
      "reference_code": "string",
      "product_type": "goods",
      "status": "pending",
      "customer_id": "string",
      "quote_date": "2019-08-24",
      "valid_until": "2019-08-24",
      "salesperson_name": "string",
      "estimated_delivery_date": "2019-08-24",
      "description": "string",
      "subtotal": "1500.000000",
      "discount_amount": "0.000000",
      "discount_rate": "10.000000",
      "total_discount": "0.000000",
      "total": "1500.000000",
      "metadata": {},
      "created_at": "2019-08-24T14:15:22Z",
      "updated_at": "2019-08-24T14:15:22Z",
      "deleted_at": "2019-08-24T14:15:22Z",
      "customer": {},
      "items": [
        {
          "id": "string",
          "quote_id": "string",
          "item_description": "string",
          "product_id": "string",
          "quantity": "2.000000",
          "unit_price": "100.000000",
          "discount_amount": "0.000000",
          "subtotal": "200.000000",
          "total": "200.000000",
          "position": 0,
          "created_at": "2019-08-24T14:15:22Z",
          "updated_at": "2019-08-24T14:15:22Z",
          "deleted_at": "2019-08-24T14:15:22Z",
          "product": {
            "id": "string",
            "record_number": 0,
            "reference_code": "string",
            "name": "string",
            "description": "string",
            "tags": [
              "string"
            ],
            "type": "goods",
            "sale_price": "99.900000",
            "image_url": "string",
            "is_blocked": true,
            "metadata": {},
            "unit_of_measurement_id": "4e07c0f9-efdb-49c6-a977-aed0b75f3157",
            "unit_of_measurement": {
              "id": "string",
              "code": "string",
              "symbol": "string",
              "fiscal_codes": {
                "property1": "string",
                "property2": "string"
              },
              "country_codes": [
                "string"
              ],
              "titles": {
                "property1": "string",
                "property2": "string"
              },
              "descriptions": {
                "property1": "string",
                "property2": "string"
              },
              "is_blocked": true,
              "display_order": 0,
              "created_at": "2019-08-24T14:15:22Z",
              "updated_at": "2019-08-24T14:15:22Z"
            },
            "br_data": {
              "ncm_code": "string",
              "cest_code": "string",
              "federal_service_code": "string",
              "city_service_code": "string",
              "nbs_code": "string",
              "taxation_type": "taxation_in_municipality",
              "cnae_code": "string",
              "ibs_cbs_cst": "string",
              "ibs_cbs_classification": "string",
              "ibs_cbs_operation_indicator_code": "string",
              "ibs_cbs_is_personal_use": true,
              "origin": "string",
              "extipi": "string"
            },
            "us_data": {
              "hts_code": "string",
              "schedule_b_code": "string",
              "eccn_code": "string",
              "tax_code": "string",
              "sales_tax_category": "string",
              "country_of_origin": "string",
              "upc_code": "string"
            },
            "created_at": "2019-08-24T14:15:22Z",
            "updated_at": "2019-08-24T14:15:22Z",
            "deleted_at": "2019-08-24T14:15:22Z"
          }
        }
      ]
    },
    "invoice": {
      "id": "string",
      "record_number": 0,
      "reference_code": "string",
      "status": "string",
      "invoice_date": "2019-08-24",
      "product_type": "goods",
      "operation_type": "string",
      "customer_id": "string",
      "subtotal": "string",
      "total": "string",
      "created_at": "2019-08-24T14:15:22Z",
      "updated_at": "2019-08-24T14:15:22Z",
      "deleted_at": "2019-08-24T14:15:22Z"
    },
    "items": [
      {
        "id": "string",
        "sales_order_id": "string",
        "product_id": "string",
        "item_description": "string",
        "quantity": "2.000000",
        "unit_price": "100.000000",
        "discount_amount": "0.000000",
        "subtotal": "200.000000",
        "total": "200.000000",
        "position": 0,
        "created_at": "2019-08-24T14:15:22Z",
        "updated_at": "2019-08-24T14:15:22Z",
        "deleted_at": "2019-08-24T14:15:22Z",
        "product": {
          "id": "string",
          "record_number": 0,
          "reference_code": "string",
          "name": "string",
          "description": "string",
          "tags": [
            "string"
          ],
          "type": "goods",
          "sale_price": "99.900000",
          "image_url": "string",
          "is_blocked": true,
          "metadata": {},
          "unit_of_measurement_id": "4e07c0f9-efdb-49c6-a977-aed0b75f3157",
          "unit_of_measurement": {
            "id": "string",
            "code": "string",
            "symbol": "string",
            "fiscal_codes": {
              "property1": "string",
              "property2": "string"
            },
            "country_codes": [
              "string"
            ],
            "titles": {
              "property1": "string",
              "property2": "string"
            },
            "descriptions": {
              "property1": "string",
              "property2": "string"
            },
            "is_blocked": true,
            "display_order": 0,
            "created_at": "2019-08-24T14:15:22Z",
            "updated_at": "2019-08-24T14:15:22Z"
          },
          "br_data": {
            "ncm_code": "string",
            "cest_code": "string",
            "federal_service_code": "string",
            "city_service_code": "string",
            "nbs_code": "string",
            "taxation_type": "taxation_in_municipality",
            "cnae_code": "string",
            "ibs_cbs_cst": "string",
            "ibs_cbs_classification": "string",
            "ibs_cbs_operation_indicator_code": "string",
            "ibs_cbs_is_personal_use": true,
            "origin": "string",
            "extipi": "string"
          },
          "us_data": {
            "hts_code": "string",
            "schedule_b_code": "string",
            "eccn_code": "string",
            "tax_code": "string",
            "sales_tax_category": "string",
            "country_of_origin": "string",
            "upc_code": "string"
          },
          "created_at": "2019-08-24T14:15:22Z",
          "updated_at": "2019-08-24T14:15:22Z",
          "deleted_at": "2019-08-24T14:15:22Z"
        }
      }
    ],
    "receivables": [
      {
        "id": "string",
        "reference_code": "string",
        "status": "string",
        "amount": "1500.000000",
        "discount_amount": "0.000000",
        "due_date": "2019-08-24",
        "paid_at": "2019-08-24T14:15:22Z",
        "payment_method_id": "ec18d2d7-d2e0-41e4-98e4-847f14422d8a",
        "financial_account_id": "12004dd2-b67b-4561-b5c8-278b86c292fd",
        "installment_number": 0,
        "installment_count": 0,
        "description": "string"
      }
    ],
    "has_active_receivables": true
  }
}
{
  "status_code": 404,
  "message": "Customer not found",
  "error": "Not Found",
  "code": "CUSTOMER_NOT_FOUND",
  "details": {
    "field": "tax_id",
    "existing_id": "018f3e4c-9b4a-7b01-8d4a-6de1f0f80001"
  }
}
{
  "status_code": 404,
  "message": "Customer not found",
  "error": "Not Found",
  "code": "CUSTOMER_NOT_FOUND",
  "details": {
    "field": "tax_id",
    "existing_id": "018f3e4c-9b4a-7b01-8d4a-6de1f0f80001"
  }
}
{
  "status_code": 404,
  "message": "Customer not found",
  "error": "Not Found",
  "code": "CUSTOMER_NOT_FOUND",
  "details": {
    "field": "tax_id",
    "existing_id": "018f3e4c-9b4a-7b01-8d4a-6de1f0f80001"
  }
}
{
  "status_code": 404,
  "message": "Customer not found",
  "error": "Not Found",
  "code": "CUSTOMER_NOT_FOUND",
  "details": {
    "field": "tax_id",
    "existing_id": "018f3e4c-9b4a-7b01-8d4a-6de1f0f80001"
  }
}
{
  "status_code": 404,
  "message": "Customer not found",
  "error": "Not Found",
  "code": "CUSTOMER_NOT_FOUND",
  "details": {
    "field": "tax_id",
    "existing_id": "018f3e4c-9b4a-7b01-8d4a-6de1f0f80001"
  }
}
{
  "status_code": 404,
  "message": "Customer not found",
  "error": "Not Found",
  "code": "CUSTOMER_NOT_FOUND",
  "details": {
    "field": "tax_id",
    "existing_id": "018f3e4c-9b4a-7b01-8d4a-6de1f0f80001"
  }
}