curl --request POST \
--url https://api.useopenwrench.com/api/external/v1/supplier/invoice/file/upload_and_publish/{invoiceId} \
--header 'Content-Type: multipart/form-data' \
--header 'OW-KEY: <api-key>' \
--header 'X-API-KEY: <api-key>' \
--form file='@example-file'import requests
url = "https://api.useopenwrench.com/api/external/v1/supplier/invoice/file/upload_and_publish/{invoiceId}"
files = { "file": ("example-file", open("example-file", "rb")) }
headers = {
"X-API-KEY": "<api-key>",
"OW-KEY": "<api-key>"
}
response = requests.post(url, files=files, headers=headers)
print(response.text)const form = new FormData();
form.append('file', '<string>');
const options = {method: 'POST', headers: {'X-API-KEY': '<api-key>', 'OW-KEY': '<api-key>'}};
options.body = form;
fetch('https://api.useopenwrench.com/api/external/v1/supplier/invoice/file/upload_and_publish/{invoiceId}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.useopenwrench.com/api/external/v1/supplier/invoice/file/upload_and_publish/{invoiceId}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001--",
CURLOPT_HTTPHEADER => [
"Content-Type: multipart/form-data",
"OW-KEY: <api-key>",
"X-API-KEY: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.useopenwrench.com/api/external/v1/supplier/invoice/file/upload_and_publish/{invoiceId}"
payload := strings.NewReader("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001--")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-API-KEY", "<api-key>")
req.Header.Add("OW-KEY", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.useopenwrench.com/api/external/v1/supplier/invoice/file/upload_and_publish/{invoiceId}")
.header("X-API-KEY", "<api-key>")
.header("OW-KEY", "<api-key>")
.body("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001--")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.useopenwrench.com/api/external/v1/supplier/invoice/file/upload_and_publish/{invoiceId}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-API-KEY"] = '<api-key>'
request["OW-KEY"] = '<api-key>'
request.body = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001--"
response = http.request(request)
puts response.read_body{
"type": "<string>",
"data": {
"id": 123,
"status": "<string>",
"scope": "<string>",
"externalWorkOrderId": "<string>",
"paymentTerms": "<string>",
"poNumber": "<string>",
"glCode": "<string>",
"dueDate": "2023-11-07T05:31:56Z",
"publishedAt": "2023-11-07T05:31:56Z",
"approvedAt": "2023-11-07T05:31:56Z",
"processedAt": "2023-11-07T05:31:56Z",
"markedPaidAt": "2023-11-07T05:31:56Z",
"dateOfInvoice": "2023-11-07T05:31:56Z",
"invoiceNumber": "<string>",
"invoiceNotes": [
{
"text": "<string>",
"noteAddedBy": "<string>",
"noteAddedAt": "2023-11-07T05:31:56Z",
"id": 123,
"photo": "<string>",
"video": "<string>",
"audio": "<string>",
"otherFile": "<string>",
"elements": [
{
"type": "<string>",
"value": "<string>",
"userObject": {
"email": "<string>",
"nameGiven": "<string>",
"nameFamily": "<string>",
"contactType": "<string>",
"title": "<string>",
"department": "<string>",
"facilityId": 123,
"isSharedContact": true,
"readOnlyAccess": true,
"invitedByEmail": "<string>",
"invitedAt": "2023-11-07T05:31:56Z",
"epaCertificationType": "<string>",
"epaCertificationNumber": "<string>",
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z"
}
}
],
"noteReadDetails": [
{
"readAt": "2023-11-07T05:31:56Z",
"readBy": "<string>",
"readByContact": {
"email": "<string>",
"nameGiven": "<string>",
"nameFamily": "<string>",
"contactType": "<string>",
"title": "<string>",
"department": "<string>",
"facilityId": 123,
"isSharedContact": true,
"readOnlyAccess": true,
"invitedByEmail": "<string>",
"invitedAt": "2023-11-07T05:31:56Z",
"epaCertificationType": "<string>",
"epaCertificationNumber": "<string>",
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z"
}
}
],
"noteAddedByContact": {
"email": "<string>",
"nameGiven": "<string>",
"nameFamily": "<string>",
"contactType": "<string>",
"title": "<string>",
"department": "<string>",
"facilityId": 123,
"isSharedContact": true,
"readOnlyAccess": true,
"invitedByEmail": "<string>",
"invitedAt": "2023-11-07T05:31:56Z",
"epaCertificationType": "<string>",
"epaCertificationNumber": "<string>",
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z"
},
"noteType": "<string>",
"noteAddedByType": "<string>",
"caption": "<string>",
"isNoteAwaitingResponse": true
}
],
"invoiceTaxRate": "<string>",
"invoiceTax": "<string>",
"invoiceTotalBeforeTax": "<string>",
"invoiceTotalAfterTax": "<string>",
"laborTotalBeforeTax": "<string>",
"materialTotalBeforeTax": "<string>",
"travelTotalBeforeTax": "<string>",
"freightTotalBeforeTax": "<string>",
"miscTotalBeforeTax": "<string>",
"taxLineItems": [
{
"taxType": "<string>",
"amount": "<string>"
}
],
"attachments": [
{
"fileName": "<string>",
"fileId": "<string>"
}
],
"invoicePDFs": [
{
"orderingId": 123,
"link": "<string>"
}
],
"workOrderId": 123,
"serviceCallIds": [
123
],
"problemTypeId": 123,
"supplierFacilityId": 123,
"buyerSupplierRelationship": {},
"locationId": 123,
"buyerFacilityId": 123,
"buyerCompanyId": 123,
"isBuyerUploaded": true,
"createdBy": "<string>",
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z",
"isDeleted": true,
"deletedAt": "2023-11-07T05:31:56Z",
"laborLineItems": [
{
"numberOfTech": 123,
"seconds": 123,
"description": "<string>",
"roleType": "<string>",
"laborType": "<string>",
"hourlyRate": "<string>",
"amount": "<string>"
}
],
"materialLineItems": [
{
"unitType": "<string>",
"quantity": "<string>",
"description": "<string>",
"partNumber": "<string>",
"partId": 123,
"equipmentNumber": "<string>",
"equipmentId": 123,
"unitPrice": "<string>",
"amount": "<string>"
}
],
"travelLineItems": [
{
"description": "<string>",
"amount": "<string>"
}
],
"freightLineItems": [
{
"description": "<string>",
"amount": "<string>"
}
],
"miscLineItems": [
{
"description": "<string>",
"amount": "<string>"
}
]
},
"status": "ok"
}{
"message": "<string>",
"type": "<string>",
"status": "error",
"traceId": "<string>"
}{
"message": "<string>",
"type": "<string>",
"status": "error",
"traceId": "<string>"
}{
"message": "<string>",
"type": "<string>",
"status": "error",
"traceId": "<string>"
}Upload an invoice PDF and publish the invoice
Uploads a PDF for an existing draft invoice and publishes it: the file becomes the invoice’s single invoicePDFs entry and the status is set to “pending”. Preconditions (each answered with 400): the API key’s facility must own the invoice, the associated work order must be in Completed display status, and supplier invoice editing must be allowed. Multipart upload, max 512 MB.
curl --request POST \
--url https://api.useopenwrench.com/api/external/v1/supplier/invoice/file/upload_and_publish/{invoiceId} \
--header 'Content-Type: multipart/form-data' \
--header 'OW-KEY: <api-key>' \
--header 'X-API-KEY: <api-key>' \
--form file='@example-file'import requests
url = "https://api.useopenwrench.com/api/external/v1/supplier/invoice/file/upload_and_publish/{invoiceId}"
files = { "file": ("example-file", open("example-file", "rb")) }
headers = {
"X-API-KEY": "<api-key>",
"OW-KEY": "<api-key>"
}
response = requests.post(url, files=files, headers=headers)
print(response.text)const form = new FormData();
form.append('file', '<string>');
const options = {method: 'POST', headers: {'X-API-KEY': '<api-key>', 'OW-KEY': '<api-key>'}};
options.body = form;
fetch('https://api.useopenwrench.com/api/external/v1/supplier/invoice/file/upload_and_publish/{invoiceId}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.useopenwrench.com/api/external/v1/supplier/invoice/file/upload_and_publish/{invoiceId}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001--",
CURLOPT_HTTPHEADER => [
"Content-Type: multipart/form-data",
"OW-KEY: <api-key>",
"X-API-KEY: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.useopenwrench.com/api/external/v1/supplier/invoice/file/upload_and_publish/{invoiceId}"
payload := strings.NewReader("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001--")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-API-KEY", "<api-key>")
req.Header.Add("OW-KEY", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.useopenwrench.com/api/external/v1/supplier/invoice/file/upload_and_publish/{invoiceId}")
.header("X-API-KEY", "<api-key>")
.header("OW-KEY", "<api-key>")
.body("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001--")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.useopenwrench.com/api/external/v1/supplier/invoice/file/upload_and_publish/{invoiceId}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-API-KEY"] = '<api-key>'
request["OW-KEY"] = '<api-key>'
request.body = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001--"
response = http.request(request)
puts response.read_body{
"type": "<string>",
"data": {
"id": 123,
"status": "<string>",
"scope": "<string>",
"externalWorkOrderId": "<string>",
"paymentTerms": "<string>",
"poNumber": "<string>",
"glCode": "<string>",
"dueDate": "2023-11-07T05:31:56Z",
"publishedAt": "2023-11-07T05:31:56Z",
"approvedAt": "2023-11-07T05:31:56Z",
"processedAt": "2023-11-07T05:31:56Z",
"markedPaidAt": "2023-11-07T05:31:56Z",
"dateOfInvoice": "2023-11-07T05:31:56Z",
"invoiceNumber": "<string>",
"invoiceNotes": [
{
"text": "<string>",
"noteAddedBy": "<string>",
"noteAddedAt": "2023-11-07T05:31:56Z",
"id": 123,
"photo": "<string>",
"video": "<string>",
"audio": "<string>",
"otherFile": "<string>",
"elements": [
{
"type": "<string>",
"value": "<string>",
"userObject": {
"email": "<string>",
"nameGiven": "<string>",
"nameFamily": "<string>",
"contactType": "<string>",
"title": "<string>",
"department": "<string>",
"facilityId": 123,
"isSharedContact": true,
"readOnlyAccess": true,
"invitedByEmail": "<string>",
"invitedAt": "2023-11-07T05:31:56Z",
"epaCertificationType": "<string>",
"epaCertificationNumber": "<string>",
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z"
}
}
],
"noteReadDetails": [
{
"readAt": "2023-11-07T05:31:56Z",
"readBy": "<string>",
"readByContact": {
"email": "<string>",
"nameGiven": "<string>",
"nameFamily": "<string>",
"contactType": "<string>",
"title": "<string>",
"department": "<string>",
"facilityId": 123,
"isSharedContact": true,
"readOnlyAccess": true,
"invitedByEmail": "<string>",
"invitedAt": "2023-11-07T05:31:56Z",
"epaCertificationType": "<string>",
"epaCertificationNumber": "<string>",
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z"
}
}
],
"noteAddedByContact": {
"email": "<string>",
"nameGiven": "<string>",
"nameFamily": "<string>",
"contactType": "<string>",
"title": "<string>",
"department": "<string>",
"facilityId": 123,
"isSharedContact": true,
"readOnlyAccess": true,
"invitedByEmail": "<string>",
"invitedAt": "2023-11-07T05:31:56Z",
"epaCertificationType": "<string>",
"epaCertificationNumber": "<string>",
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z"
},
"noteType": "<string>",
"noteAddedByType": "<string>",
"caption": "<string>",
"isNoteAwaitingResponse": true
}
],
"invoiceTaxRate": "<string>",
"invoiceTax": "<string>",
"invoiceTotalBeforeTax": "<string>",
"invoiceTotalAfterTax": "<string>",
"laborTotalBeforeTax": "<string>",
"materialTotalBeforeTax": "<string>",
"travelTotalBeforeTax": "<string>",
"freightTotalBeforeTax": "<string>",
"miscTotalBeforeTax": "<string>",
"taxLineItems": [
{
"taxType": "<string>",
"amount": "<string>"
}
],
"attachments": [
{
"fileName": "<string>",
"fileId": "<string>"
}
],
"invoicePDFs": [
{
"orderingId": 123,
"link": "<string>"
}
],
"workOrderId": 123,
"serviceCallIds": [
123
],
"problemTypeId": 123,
"supplierFacilityId": 123,
"buyerSupplierRelationship": {},
"locationId": 123,
"buyerFacilityId": 123,
"buyerCompanyId": 123,
"isBuyerUploaded": true,
"createdBy": "<string>",
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z",
"isDeleted": true,
"deletedAt": "2023-11-07T05:31:56Z",
"laborLineItems": [
{
"numberOfTech": 123,
"seconds": 123,
"description": "<string>",
"roleType": "<string>",
"laborType": "<string>",
"hourlyRate": "<string>",
"amount": "<string>"
}
],
"materialLineItems": [
{
"unitType": "<string>",
"quantity": "<string>",
"description": "<string>",
"partNumber": "<string>",
"partId": 123,
"equipmentNumber": "<string>",
"equipmentId": 123,
"unitPrice": "<string>",
"amount": "<string>"
}
],
"travelLineItems": [
{
"description": "<string>",
"amount": "<string>"
}
],
"freightLineItems": [
{
"description": "<string>",
"amount": "<string>"
}
],
"miscLineItems": [
{
"description": "<string>",
"amount": "<string>"
}
]
},
"status": "ok"
}{
"message": "<string>",
"type": "<string>",
"status": "error",
"traceId": "<string>"
}{
"message": "<string>",
"type": "<string>",
"status": "error",
"traceId": "<string>"
}{
"message": "<string>",
"type": "<string>",
"status": "error",
"traceId": "<string>"
}Autorizaciones
OpenWrench shared secret. Required on every request alongside X-API-KEY; issued together with your API key.
Parámetros de ruta
Invoice id
Cuerpo
The invoice PDF
Respuesta
Successful response
Entity type label, e.g. "Invoice". Endpoints that derive it via Scala reflection (most generic list/get endpoints) may return the fully qualified server class name instead (e.g. "models.workorder.WorkOrder"); treat this field as informational.
Invoice in its external-API projection (InvoiceExternalAPI = full Invoice fields with buyerSupplierRelationship replaced by an external projection). Abridged - the full model carries approval-hierarchy, dispute and hydrated relation fields. For third-party suppliers responses are masked.
Show child attributes
Show child attributes
"ok" on success
ok