Purchase Orders
Lock purchase order
Locks a purchase order to prevent modifications
POST
/
v1
/
purchase-orders
/
{purchaseOrderId}
/
lock
Lock purchase order
curl --request POST \
--url https://api.light.inc/v1/purchase-orders/{purchaseOrderId}/lock \
--header 'Authorization: <api-key>'import requests
url = "https://api.light.inc/v1/purchase-orders/{purchaseOrderId}/lock"
headers = {"Authorization": "<api-key>"}
response = requests.post(url, headers=headers)
print(response.text)const options = {method: 'POST', headers: {Authorization: '<api-key>'}};
fetch('https://api.light.inc/v1/purchase-orders/{purchaseOrderId}/lock', 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.light.inc/v1/purchase-orders/{purchaseOrderId}/lock",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"Authorization: <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"
"net/http"
"io"
)
func main() {
url := "https://api.light.inc/v1/purchase-orders/{purchaseOrderId}/lock"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("Authorization", "<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.light.inc/v1/purchase-orders/{purchaseOrderId}/lock")
.header("Authorization", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.light.inc/v1/purchase-orders/{purchaseOrderId}/lock")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"companyId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"createdBy": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"companyEntityId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"purchaseRequestId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"totalAmount": 123,
"totalNetAmount": 123,
"totalTaxAmount": 123,
"erpNumber": "<string>",
"description": "<string>",
"currency": "USD",
"ownerId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"vendorId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"vendorEmail": "<string>",
"deliveryAddress": "<string>",
"deliveryDate": "2023-12-25",
"documentKey": "<string>",
"failureContext": {
"name": "<string>",
"errors": [
{
"type": "<string>",
"message": "<string>",
"path": [
"<string>"
],
"context": {}
}
]
},
"purchaseOrderDate": "2023-12-25",
"erpSyncedAt": "2023-11-07T05:31:56Z",
"lockedAt": "2023-11-07T05:31:56Z",
"closedAt": "2023-11-07T05:31:56Z",
"cancelledAt": "2023-11-07T05:31:56Z",
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z",
"lines": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"companyId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"purchaseOrderId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"description": "<string>",
"costCenterId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"accountId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"taxCodeId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"quantity": 123,
"unitPrice": 123,
"amount": 123,
"netAmount": 123,
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z",
"customProperties": [
{
"groupId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"groupInternalName": "<string>",
"values": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"groupId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"groupInternalName": "<string>",
"companyId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"internalName": "<string>",
"label": "<string>",
"context": "<string>",
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z"
}
]
}
]
}
],
"customProperties": [
{
"groupId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"groupInternalName": "<string>",
"values": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"groupId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"groupInternalName": "<string>",
"companyId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"internalName": "<string>",
"label": "<string>",
"context": "<string>",
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z"
}
]
}
]
}Authorizations
apiKeyAuthbearerAuth
Basic authentication header of the form Basic <api_key>, where <api_key> is your api key.
Path Parameters
Response
default - application/json;charset=UTF-8
default response
⚠️ This enum is not exhaustive; new values may be added in the future.
Available options:
IN_DRAFT, RESET_PENDING, APPROVED_ACCOUNTING_ENTRY_PENDING, OPEN, CLOSE_PENDING, CLOSED, CANCEL_PENDING, CANCELLED Example:
"USD"
Failure context when vendor onboarding fails.
Show child attributes
Show child attributes
⚠️ This enum is not exhaustive; new values may be added in the future.
Available options:
ALL_EDITS_ALLOWED, ALL_EDITS_LOCKED Show child attributes
Show child attributes
Custom properties set on the vendor.
Show child attributes
Show child attributes
⌘I
Lock purchase order
curl --request POST \
--url https://api.light.inc/v1/purchase-orders/{purchaseOrderId}/lock \
--header 'Authorization: <api-key>'import requests
url = "https://api.light.inc/v1/purchase-orders/{purchaseOrderId}/lock"
headers = {"Authorization": "<api-key>"}
response = requests.post(url, headers=headers)
print(response.text)const options = {method: 'POST', headers: {Authorization: '<api-key>'}};
fetch('https://api.light.inc/v1/purchase-orders/{purchaseOrderId}/lock', 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.light.inc/v1/purchase-orders/{purchaseOrderId}/lock",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"Authorization: <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"
"net/http"
"io"
)
func main() {
url := "https://api.light.inc/v1/purchase-orders/{purchaseOrderId}/lock"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("Authorization", "<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.light.inc/v1/purchase-orders/{purchaseOrderId}/lock")
.header("Authorization", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.light.inc/v1/purchase-orders/{purchaseOrderId}/lock")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"companyId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"createdBy": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"companyEntityId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"purchaseRequestId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"totalAmount": 123,
"totalNetAmount": 123,
"totalTaxAmount": 123,
"erpNumber": "<string>",
"description": "<string>",
"currency": "USD",
"ownerId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"vendorId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"vendorEmail": "<string>",
"deliveryAddress": "<string>",
"deliveryDate": "2023-12-25",
"documentKey": "<string>",
"failureContext": {
"name": "<string>",
"errors": [
{
"type": "<string>",
"message": "<string>",
"path": [
"<string>"
],
"context": {}
}
]
},
"purchaseOrderDate": "2023-12-25",
"erpSyncedAt": "2023-11-07T05:31:56Z",
"lockedAt": "2023-11-07T05:31:56Z",
"closedAt": "2023-11-07T05:31:56Z",
"cancelledAt": "2023-11-07T05:31:56Z",
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z",
"lines": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"companyId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"purchaseOrderId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"description": "<string>",
"costCenterId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"accountId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"taxCodeId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"quantity": 123,
"unitPrice": 123,
"amount": 123,
"netAmount": 123,
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z",
"customProperties": [
{
"groupId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"groupInternalName": "<string>",
"values": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"groupId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"groupInternalName": "<string>",
"companyId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"internalName": "<string>",
"label": "<string>",
"context": "<string>",
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z"
}
]
}
]
}
],
"customProperties": [
{
"groupId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"groupInternalName": "<string>",
"values": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"groupId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"groupInternalName": "<string>",
"companyId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"internalName": "<string>",
"label": "<string>",
"context": "<string>",
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z"
}
]
}
]
}