Create Purchase Orders
POSThttps://secure.fleetio.com/api/v1/purchase_orders
Creates a new Purchase Order
Request
- application/json
Body
A comma separated list of tags associated with this record. The only
delimiter allowed is a comma (,
). Please remove any commas from your
labels before saving the record.
Possible values: <= 255 characters
High Priority
Possible values: >= 1
The Fleetio ID of the Part Location for the Part being purchased.
Possible values: >= 1
Must be unique within the scope of your Account. You can either generate your own number or leave it blank and Fleetio will generate one for you. Fleetio will use the next number in the sequence based on your existing Purchase Orders. This becomes the unique identifier, even in endpoints. Id is never used.
1207
The type of discount applied to this record.
Possible values: [fixed
, percentage
]
percentage
The discount percentage. This field should be present when discount_type
is set to percentage
.
The actual value of the discount
The cost of shipping
The primary tax percentage amount. This field should be present when
tax_1_type
is set to percentage
.
The primary tax amount.
The type of tax to apply to this record.
Possible values: [fixed
, percentage
]
percentage
The secondary tax percentage amount. This field should be present when
tax_2_type
is set to percentage
. Note that this secondary tax must be
configured in your Account
Settings.
The secondary tax amount. Note that this secondary tax must be configured in your Account Settings.
The type of tax to apply to this record.
Possible values: [fixed
, percentage
]
percentage
*Full details on working with Custom Fields here.
purchase_order_line_items_attributes object[]
Responses
- 201
- 401
- 403
- 422
- 500
OK
Response Headers
- application/json
- Schema
- Example (auto)
Schema
Possible values: >= 1
The date and time at which this record was created.
2023-03-14T13:46:27-06:00
The date and time at which this record was most recently updated.
2023-03-14T13:46:27-06:00
The type of discount applied to this record.
Possible values: [fixed
, percentage
]
percentage
The discount percentage. This field should be present when
discount_type
is set to percentage
.
1.23
The discount amount in cents.
The type of tax to apply to this record.
Possible values: [fixed
, percentage
]
percentage
The primary tax percentage amount. This field should be present when
tax_1_type
is set to percentage
.
1.23
The primary tax amount in cents.
123
The type of tax to apply to this record.
Possible values: [fixed
, percentage
]
percentage
The secondary tax percentage amount. This field should be present when tax_2_type
is
set to percentage
. Note that this secondary tax must be configured in
your Account Settings.
1.23
The secondary tax amount in cents.
The shipping amount in cents.
Possible values: >= 1
Must be unique within the scope of your Account. You can either generate your own number or leave it blank and Fleetio will generate one for you. Fleetio will use the next number in the sequence based on your existing Purchase Orders. This becomes the unique identifier, even in endpoints. Id is never used.
1207
Open text field for Purchase Order description.
A list of tags associated with this record.
Possible values: <= 255 characters
The date and time at which this Purchase Order was submitted for approval.
2023-03-14T13:46:27-06:00
The date and time at which this Purchase Order was rejected.
2023-03-14T13:46:27-06:00
The date and time at which this Purchase Order was approved.
2023-03-14T13:46:27-06:00
The date and time at which this Purchase Order was purchased.
2023-03-14T13:46:27-06:00
The date and time at which this Purchase Order was partially received.
2023-03-14T13:46:27-06:00
The date and time at which this Purchase Order was fully received.
2023-03-14T13:46:27-06:00
The date and time at which this Purchase Order was closed.
2023-03-14T13:46:27-06:00
See the Purchase Order Lifecycle Guide for more information about Purchase Order states and how to transition between them.
Possible values: [draft
, submitted_for_approval
, rejected
, approved
, purchased
, received_partial
, received_full
, closed
]
*Full details on working with Custom Fields here.
The ID of the Part Location
associated with this Purchase Order. Optional
in the draft
state.
Possible values: >= 1
The ID of the Vendor associated with this Purchase Order.
Possible values: >= 1
Possible values: >= 1
The ID of the Vendor associated with the User who created this Purchase Order.
Possible values: >= 1
The ID of the Vendor associated with the User who closed this Purchase Order.
Possible values: >= 1
The ID of the Vendor associated with the User who submitted this Purchase Order for approval.
Possible values: >= 1
The ID of the Vendor associated with the User who approved this Purchase Order.
Possible values: >= 1
The ID of the Vendor associated with the User who purchased this Purchase Order.
Possible values: >= 1
The ID of the Vendor associated with the User who partially received this Purchase Order.
Possible values: >= 1
The ID of the Vendor associated with the User who fully received this Purchase Order.
Possible values: >= 1
The ID of the Vendor associated with the User who closed this Purchase Order.
Possible values: >= 1
The number of documents attached to this Purchase Order.
The number of Comments
on this Purchase Order.
The subtotal amount in cents.
The total amount in cents.
The count of watchers associated with the record.
Options related to watching the record.
Indicates if a bulk watch record is created.
Indicates if automatic watchers callbacks are skipped.
{
"id": 0,
"created_at": "2023-03-14T13:46:27-06:00",
"updated_at": "2023-03-14T13:46:27-06:00",
"discount_type": "percentage",
"discount_percentage": 1.23,
"discount_cents": 0,
"tax_1_type": "percentage",
"tax_1_percentage": 1.23,
"tax_1_cents": 123,
"tax_2_type": "percentage",
"tax_2_percentage": 1.23,
"tax_2_cents": 0,
"shipping_cents": 0,
"account_id": 0,
"number": 1207,
"description": "string",
"label_list": [
"High Priority"
],
"submitted_for_approval_at": "2023-03-14T13:46:27-06:00",
"rejected_at": "2023-03-14T13:46:27-06:00",
"approved_at": "2023-03-14T13:46:27-06:00",
"purchased_at": "2023-03-14T13:46:27-06:00",
"received_partial_at": "2023-03-14T13:46:27-06:00",
"received_full_at": "2023-03-14T13:46:27-06:00",
"closed_at": "2023-03-14T13:46:27-06:00",
"state": "draft",
"custom_fields": {},
"part_location_id": 0,
"vendor_id": 0,
"purchase_order_status_id": 0,
"created_by_id": 0,
"rejected_by_id": 0,
"submitted_for_approval_by_id": 0,
"approved_by_id": 0,
"purchased_by_id": 0,
"received_partial_by_id": 0,
"received_full_by_id": 0,
"closed_by_id": 0,
"documents_count": 0,
"comments_count": 0,
"subtotal_cents": 0,
"total_amount_cents": 0,
"watchers_count": 0,
"watchable_options": {},
"bulk_watch_record": true,
"skip_automatic_watchers_callbacks": true
}
Request could not be authenticated
- application/json
- Schema
- Example (auto)
Schema
Possible values: >= 400
and <= 599
A short, human-readable summary of the problem type. It SHOULD NOT change from occurrence to occurrence of the problem, except for purposes of localization.
A human-readable explanation specific to this occurrence of the problem.
A URI reference that identifies the specific occurrence of the problem. It may or may not yield further information if dereferenced.
{
"status": 0,
"title": "string",
"detail": "string",
"instance": "string"
}
Insufficient permission to perform this operation
- application/json
- Schema
- Example (auto)
Schema
Possible values: >= 400
and <= 599
A short, human-readable summary of the problem type. It SHOULD NOT change from occurrence to occurrence of the problem, except for purposes of localization.
A human-readable explanation specific to this occurrence of the problem.
A URI reference that identifies the specific occurrence of the problem. It may or may not yield further information if dereferenced.
{
"status": 0,
"title": "string",
"detail": "string",
"instance": "string"
}
Unprocessable Entity
- application/json
- Schema
- Example (auto)
- Example
Schema
errors object
{
"errors": {}
}
{
"errors": {
"field1": [
"error1",
"error2"
],
"field2": [
"error3"
]
}
}
Something unexpected happened
- application/json
- Schema
- Example (auto)
Schema
Possible values: >= 400
and <= 599
A short, human-readable summary of the problem type. It SHOULD NOT change from occurrence to occurrence of the problem, except for purposes of localization.
A human-readable explanation specific to this occurrence of the problem.
A URI reference that identifies the specific occurrence of the problem. It may or may not yield further information if dereferenced.
{
"status": 0,
"title": "string",
"detail": "string",
"instance": "string"
}
Authorization: Authorization
name: Authorizationtype: apiKeyin: headerdescription: Prefix the value with "Token", for example: "Token 76cbe06c49a64". You can generate a new API key [here](https://secure.fleetio.com/api_keys).
name: Account-Tokentype: apiKeyin: headerdescription: You can find your Account-Token [here](https://secure.fleetio.com/api_keys)
- curl
- ruby
- python
- csharp
- go
- java
- nodejs
- php
- CURL
curl -L 'https://secure.fleetio.com/api/v1/purchase_orders' \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'Authorization: Token <Authorization>' \
-H 'Account-Token: <Authorization>' \
-d '{
"description": "string",
"label_list": "High Priority",
"vendor_id": 0,
"part_location_id": 0,
"number": 1207,
"discount_type": "percentage",
"discount_percentage": 0,
"discount": 0,
"shipping": 0,
"tax_1_percentage": 0,
"tax_1": 0,
"tax_1_type": "percentage",
"tax_2_percentage": 0,
"tax_2": 0,
"tax_2_type": "percentage",
"custom_fields": {},
"purchase_order_line_items_attributes": [
{
"part_id": 0,
"quantity": 0,
"unit_cost": 0
}
]
}'