Upload shipping document
curl --request POST \
--url https://api.teleship.com/documents/etds/upload \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"shipmentId": "<string>",
"electronicTradeDocuments": [
{
"content": "JVBERi0xLjQKJQlJbTgKMSAwIG9iago8PSplbiAkZwoKCSvQ==",
"name": "commercial-invoice.pdf",
"type": "COMMERCIAL_INVOICE",
"format": "PDF"
}
]
}
'import requests
url = "https://api.teleship.com/documents/etds/upload"
payload = {
"shipmentId": "<string>",
"electronicTradeDocuments": [
{
"content": "JVBERi0xLjQKJQlJbTgKMSAwIG9iago8PSplbiAkZwoKCSvQ==",
"name": "commercial-invoice.pdf",
"type": "COMMERCIAL_INVOICE",
"format": "PDF"
}
]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
shipmentId: '<string>',
electronicTradeDocuments: [
{
content: 'JVBERi0xLjQKJQlJbTgKMSAwIG9iago8PSplbiAkZwoKCSvQ==',
name: 'commercial-invoice.pdf',
type: 'COMMERCIAL_INVOICE',
format: 'PDF'
}
]
})
};
fetch('https://api.teleship.com/documents/etds/upload', 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.teleship.com/documents/etds/upload",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'shipmentId' => '<string>',
'electronicTradeDocuments' => [
[
'content' => 'JVBERi0xLjQKJQlJbTgKMSAwIG9iago8PSplbiAkZwoKCSvQ==',
'name' => 'commercial-invoice.pdf',
'type' => 'COMMERCIAL_INVOICE',
'format' => 'PDF'
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$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.teleship.com/documents/etds/upload"
payload := strings.NewReader("{\n \"shipmentId\": \"<string>\",\n \"electronicTradeDocuments\": [\n {\n \"content\": \"JVBERi0xLjQKJQlJbTgKMSAwIG9iago8PSplbiAkZwoKCSvQ==\",\n \"name\": \"commercial-invoice.pdf\",\n \"type\": \"COMMERCIAL_INVOICE\",\n \"format\": \"PDF\"\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
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.teleship.com/documents/etds/upload")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"shipmentId\": \"<string>\",\n \"electronicTradeDocuments\": [\n {\n \"content\": \"JVBERi0xLjQKJQlJbTgKMSAwIG9iago8PSplbiAkZwoKCSvQ==\",\n \"name\": \"commercial-invoice.pdf\",\n \"type\": \"COMMERCIAL_INVOICE\",\n \"format\": \"PDF\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.teleship.com/documents/etds/upload")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"shipmentId\": \"<string>\",\n \"electronicTradeDocuments\": [\n {\n \"content\": \"JVBERi0xLjQKJQlJbTgKMSAwIG9iago8PSplbiAkZwoKCSvQ==\",\n \"name\": \"commercial-invoice.pdf\",\n \"type\": \"COMMERCIAL_INVOICE\",\n \"format\": \"PDF\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"messages": [
{
"code": 123,
"level": "error",
"timestamp": "2024-01-01T00:00:00.00Z",
"message": "An error occurred",
"details": [
"Missing required field"
]
}
]
}{
"messages": [
{
"code": 123,
"level": "error",
"timestamp": "2024-01-01T00:00:00.00Z",
"message": "An error occurred",
"details": [
"Missing required field"
]
}
]
}{
"messages": [
{
"code": 123,
"level": "error",
"timestamp": "2024-01-01T00:00:00.00Z",
"message": "An error occurred",
"details": [
"Missing required field"
]
}
]
}Shipping services
Upload shipping document
POST
/
documents
/
etds
/
upload
Upload shipping document
curl --request POST \
--url https://api.teleship.com/documents/etds/upload \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"shipmentId": "<string>",
"electronicTradeDocuments": [
{
"content": "JVBERi0xLjQKJQlJbTgKMSAwIG9iago8PSplbiAkZwoKCSvQ==",
"name": "commercial-invoice.pdf",
"type": "COMMERCIAL_INVOICE",
"format": "PDF"
}
]
}
'import requests
url = "https://api.teleship.com/documents/etds/upload"
payload = {
"shipmentId": "<string>",
"electronicTradeDocuments": [
{
"content": "JVBERi0xLjQKJQlJbTgKMSAwIG9iago8PSplbiAkZwoKCSvQ==",
"name": "commercial-invoice.pdf",
"type": "COMMERCIAL_INVOICE",
"format": "PDF"
}
]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
shipmentId: '<string>',
electronicTradeDocuments: [
{
content: 'JVBERi0xLjQKJQlJbTgKMSAwIG9iago8PSplbiAkZwoKCSvQ==',
name: 'commercial-invoice.pdf',
type: 'COMMERCIAL_INVOICE',
format: 'PDF'
}
]
})
};
fetch('https://api.teleship.com/documents/etds/upload', 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.teleship.com/documents/etds/upload",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'shipmentId' => '<string>',
'electronicTradeDocuments' => [
[
'content' => 'JVBERi0xLjQKJQlJbTgKMSAwIG9iago8PSplbiAkZwoKCSvQ==',
'name' => 'commercial-invoice.pdf',
'type' => 'COMMERCIAL_INVOICE',
'format' => 'PDF'
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$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.teleship.com/documents/etds/upload"
payload := strings.NewReader("{\n \"shipmentId\": \"<string>\",\n \"electronicTradeDocuments\": [\n {\n \"content\": \"JVBERi0xLjQKJQlJbTgKMSAwIG9iago8PSplbiAkZwoKCSvQ==\",\n \"name\": \"commercial-invoice.pdf\",\n \"type\": \"COMMERCIAL_INVOICE\",\n \"format\": \"PDF\"\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
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.teleship.com/documents/etds/upload")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"shipmentId\": \"<string>\",\n \"electronicTradeDocuments\": [\n {\n \"content\": \"JVBERi0xLjQKJQlJbTgKMSAwIG9iago8PSplbiAkZwoKCSvQ==\",\n \"name\": \"commercial-invoice.pdf\",\n \"type\": \"COMMERCIAL_INVOICE\",\n \"format\": \"PDF\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.teleship.com/documents/etds/upload")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"shipmentId\": \"<string>\",\n \"electronicTradeDocuments\": [\n {\n \"content\": \"JVBERi0xLjQKJQlJbTgKMSAwIG9iago8PSplbiAkZwoKCSvQ==\",\n \"name\": \"commercial-invoice.pdf\",\n \"type\": \"COMMERCIAL_INVOICE\",\n \"format\": \"PDF\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"messages": [
{
"code": 123,
"level": "error",
"timestamp": "2024-01-01T00:00:00.00Z",
"message": "An error occurred",
"details": [
"Missing required field"
]
}
]
}{
"messages": [
{
"code": 123,
"level": "error",
"timestamp": "2024-01-01T00:00:00.00Z",
"message": "An error occurred",
"details": [
"Missing required field"
]
}
]
}{
"messages": [
{
"code": 123,
"level": "error",
"timestamp": "2024-01-01T00:00:00.00Z",
"message": "An error occurred",
"details": [
"Missing required field"
]
}
]
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Body
application/json
The EDT upload payload
Response
Bad Request
Show child attributes
Show child attributes
Was this page helpful?
⌘I