curl --request POST \
--url https://api.opereit.com/v1/contracts \
--header 'Authorization: Basic <encoded-value>' \
--header 'Content-Type: multipart/form-data' \
--form file='@example-file' \
--form 'carrier_name=<string>' \
--form signing_date=2023-12-25 \
--form 'contract_number=<string>' \
--form 'account_number=<string>'import requests
url = "https://api.opereit.com/v1/contracts"
files = { "file": ("example-file", open("example-file", "rb")) }
payload = {
"carrier_name": "<string>",
"signing_date": "2023-12-25",
"contract_number": "<string>",
"account_number": "<string>"
}
headers = {"Authorization": "Basic <encoded-value>"}
response = requests.post(url, data=payload, files=files, headers=headers)
print(response.text)const form = new FormData();
form.append('file', '<string>');
form.append('carrier_name', '<string>');
form.append('signing_date', '2023-12-25');
form.append('contract_number', '<string>');
form.append('account_number', '<string>');
const options = {method: 'POST', headers: {Authorization: 'Basic <encoded-value>'}};
options.body = form;
fetch('https://api.opereit.com/v1/contracts', 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.opereit.com/v1/contracts",
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\r\nContent-Disposition: form-data; name=\"carrier_name\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"signing_date\"\r\n\r\n2023-12-25\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"contract_number\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"account_number\"\r\n\r\n<string>\r\n-----011000010111000001101001--",
CURLOPT_HTTPHEADER => [
"Authorization: Basic <encoded-value>",
"Content-Type: multipart/form-data"
],
]);
$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.opereit.com/v1/contracts"
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\r\nContent-Disposition: form-data; name=\"carrier_name\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"signing_date\"\r\n\r\n2023-12-25\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"contract_number\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"account_number\"\r\n\r\n<string>\r\n-----011000010111000001101001--")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Basic <encoded-value>")
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.opereit.com/v1/contracts")
.header("Authorization", "Basic <encoded-value>")
.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\r\nContent-Disposition: form-data; name=\"carrier_name\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"signing_date\"\r\n\r\n2023-12-25\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"contract_number\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"account_number\"\r\n\r\n<string>\r\n-----011000010111000001101001--")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.opereit.com/v1/contracts")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Basic <encoded-value>'
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\r\nContent-Disposition: form-data; name=\"carrier_name\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"signing_date\"\r\n\r\n2023-12-25\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"contract_number\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"account_number\"\r\n\r\n<string>\r\n-----011000010111000001101001--"
response = http.request(request)
puts response.read_body{
"contract": {
"id": "<string>",
"carrier_name": "DHL Express",
"signing_date": "2023-12-25",
"rate_count": 123,
"surcharge_count": 123,
"created_at": "2023-11-07T05:31:56Z",
"contract_number": "<string>",
"account_number": "<string>",
"effective_date": "2023-12-25",
"expiration_date": "2023-12-25",
"status_reason": "<string>",
"file_url": "<string>"
}
}{
"error": "<string>"
}{
"error": "<string>"
}Upload contract
Upload a carrier contract document. Opereit asynchronously extracts rate cards and surcharges from the file. The contract is created with status=PROCESSING; it transitions to ACTIVE once extraction completes (or FAILED if extraction errors out).
Accepted file formats: PDF, PNG, JPEG, CSV, XLS, XLSX.
curl --request POST \
--url https://api.opereit.com/v1/contracts \
--header 'Authorization: Basic <encoded-value>' \
--header 'Content-Type: multipart/form-data' \
--form file='@example-file' \
--form 'carrier_name=<string>' \
--form signing_date=2023-12-25 \
--form 'contract_number=<string>' \
--form 'account_number=<string>'import requests
url = "https://api.opereit.com/v1/contracts"
files = { "file": ("example-file", open("example-file", "rb")) }
payload = {
"carrier_name": "<string>",
"signing_date": "2023-12-25",
"contract_number": "<string>",
"account_number": "<string>"
}
headers = {"Authorization": "Basic <encoded-value>"}
response = requests.post(url, data=payload, files=files, headers=headers)
print(response.text)const form = new FormData();
form.append('file', '<string>');
form.append('carrier_name', '<string>');
form.append('signing_date', '2023-12-25');
form.append('contract_number', '<string>');
form.append('account_number', '<string>');
const options = {method: 'POST', headers: {Authorization: 'Basic <encoded-value>'}};
options.body = form;
fetch('https://api.opereit.com/v1/contracts', 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.opereit.com/v1/contracts",
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\r\nContent-Disposition: form-data; name=\"carrier_name\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"signing_date\"\r\n\r\n2023-12-25\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"contract_number\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"account_number\"\r\n\r\n<string>\r\n-----011000010111000001101001--",
CURLOPT_HTTPHEADER => [
"Authorization: Basic <encoded-value>",
"Content-Type: multipart/form-data"
],
]);
$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.opereit.com/v1/contracts"
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\r\nContent-Disposition: form-data; name=\"carrier_name\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"signing_date\"\r\n\r\n2023-12-25\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"contract_number\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"account_number\"\r\n\r\n<string>\r\n-----011000010111000001101001--")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Basic <encoded-value>")
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.opereit.com/v1/contracts")
.header("Authorization", "Basic <encoded-value>")
.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\r\nContent-Disposition: form-data; name=\"carrier_name\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"signing_date\"\r\n\r\n2023-12-25\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"contract_number\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"account_number\"\r\n\r\n<string>\r\n-----011000010111000001101001--")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.opereit.com/v1/contracts")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Basic <encoded-value>'
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\r\nContent-Disposition: form-data; name=\"carrier_name\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"signing_date\"\r\n\r\n2023-12-25\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"contract_number\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"account_number\"\r\n\r\n<string>\r\n-----011000010111000001101001--"
response = http.request(request)
puts response.read_body{
"contract": {
"id": "<string>",
"carrier_name": "DHL Express",
"signing_date": "2023-12-25",
"rate_count": 123,
"surcharge_count": 123,
"created_at": "2023-11-07T05:31:56Z",
"contract_number": "<string>",
"account_number": "<string>",
"effective_date": "2023-12-25",
"expiration_date": "2023-12-25",
"status_reason": "<string>",
"file_url": "<string>"
}
}{
"error": "<string>"
}{
"error": "<string>"
}Authorizations
HTTP Basic Auth using your API key. Send Authorization: Basic base64(key_id:key_secret).
Body
The contract document. Accepted MIME types: application/pdf, image/png, image/jpeg, text/csv, application/vnd.ms-excel, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.
The carrier this contract belongs to (e.g. UPS, FedEx, DHL Express).
Date the contract was signed, in YYYY-MM-DD format.
Optional carrier-issued contract number.
Optional carrier account number this contract applies to.
Response
Contract created. Extraction runs asynchronously.
A carrier contract uploaded to Opereit. Rates and surcharges are extracted asynchronously.
Show child attributes
Show child attributes