Upload File from URL
curl --request POST \
--url https://api.pdf.co/v1/file/upload/url \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"url": "<string>",
"name": "<string>",
"httpusername": "<string>",
"httppassword": "<string>"
}
'import requests
url = "https://api.pdf.co/v1/file/upload/url"
payload = {
"url": "<string>",
"name": "<string>",
"httpusername": "<string>",
"httppassword": "<string>"
}
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
url: '<string>',
name: '<string>',
httpusername: '<string>',
httppassword: '<string>'
})
};
fetch('https://api.pdf.co/v1/file/upload/url', 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.pdf.co/v1/file/upload/url",
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([
'url' => '<string>',
'name' => '<string>',
'httpusername' => '<string>',
'httppassword' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"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.pdf.co/v1/file/upload/url"
payload := strings.NewReader("{\n \"url\": \"<string>\",\n \"name\": \"<string>\",\n \"httpusername\": \"<string>\",\n \"httppassword\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<api-key>")
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.pdf.co/v1/file/upload/url")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"url\": \"<string>\",\n \"name\": \"<string>\",\n \"httpusername\": \"<string>\",\n \"httppassword\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.pdf.co/v1/file/upload/url")
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["Content-Type"] = 'application/json'
request.body = "{\n \"url\": \"<string>\",\n \"name\": \"<string>\",\n \"httpusername\": \"<string>\",\n \"httppassword\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"status": "success",
"message": "Success",
"url": "https://pdf-temp-files.s3.us-west-2.amazonaws.com/output.pdf",
"jobId": "6YSZD3U872ZYYFEDMQCQSGEEO8YSF5WA",
"credits": 2,
"remainingCredits": 1480582,
"duration": 33
}{
"error": true,
"status": 400,
"message": "Bad request. Typically due to bad input parameters or unreachable input URLs (e.g., access restrictions like login or password)."
}{
"error": true,
"status": 401,
"message": "Unauthorized. Authentication is required and has failed or has not yet been provided."
}{
"error": true,
"status": 402,
"message": "Not enough credits."
}{
"error": true,
"status": 403,
"message": "Access forbidden for input URL."
}{
"error": true,
"status": 404,
"message": "The requested resource could not be found."
}{
"error": true,
"status": 408,
"message": "The server timed out waiting for the request."
}{
"error": true,
"status": 429,
"message": "Too many requests in a given time period."
}{
"error": true,
"status": 441,
"message": "Invalid Password. Password protected document."
}{
"error": true,
"status": 442,
"message": "Input document is damaged or of incorrect type."
}{
"error": true,
"status": 443,
"message": "Permissions. The operation is prohibited by document security settings."
}{
"error": true,
"status": 444,
"message": "Profiles parsing error. Please ensure that the configuration is supported."
}{
"error": true,
"status": 445,
"message": "Timeout error. For large documents, use asynchronous mode (async=true) and check status via /job/check."
}{
"error": true,
"status": 446,
"message": "Some files required for conversion are missing."
}{
"error": true,
"status": 447,
"message": "Invalid template."
}{
"error": true,
"status": 448,
"message": "Invalid URL or HTML. Ensure the provided URL is valid and accessible."
}{
"error": true,
"status": 449,
"message": "Invalid index range. Page index is out of range."
}{
"error": true,
"status": 450,
"message": "Invalid page range specified."
}{
"error": true,
"status": 452,
"message": "Invalid URL."
}{
"error": true,
"status": 454,
"message": "Invalid parameters."
}{
"error": true,
"status": 500,
"message": "Something went wrong. Please try again or contact support."
}Document, File & System
Upload File from URL (API Tester)
Run Upload File from URL live from your browser — send a real request and see the response and credit usage, no code required. PDF.co API Tester.
POST
/
v1
/
file
/
upload
/
url
Upload File from URL
curl --request POST \
--url https://api.pdf.co/v1/file/upload/url \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"url": "<string>",
"name": "<string>",
"httpusername": "<string>",
"httppassword": "<string>"
}
'import requests
url = "https://api.pdf.co/v1/file/upload/url"
payload = {
"url": "<string>",
"name": "<string>",
"httpusername": "<string>",
"httppassword": "<string>"
}
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
url: '<string>',
name: '<string>',
httpusername: '<string>',
httppassword: '<string>'
})
};
fetch('https://api.pdf.co/v1/file/upload/url', 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.pdf.co/v1/file/upload/url",
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([
'url' => '<string>',
'name' => '<string>',
'httpusername' => '<string>',
'httppassword' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"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.pdf.co/v1/file/upload/url"
payload := strings.NewReader("{\n \"url\": \"<string>\",\n \"name\": \"<string>\",\n \"httpusername\": \"<string>\",\n \"httppassword\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<api-key>")
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.pdf.co/v1/file/upload/url")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"url\": \"<string>\",\n \"name\": \"<string>\",\n \"httpusername\": \"<string>\",\n \"httppassword\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.pdf.co/v1/file/upload/url")
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["Content-Type"] = 'application/json'
request.body = "{\n \"url\": \"<string>\",\n \"name\": \"<string>\",\n \"httpusername\": \"<string>\",\n \"httppassword\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"status": "success",
"message": "Success",
"url": "https://pdf-temp-files.s3.us-west-2.amazonaws.com/output.pdf",
"jobId": "6YSZD3U872ZYYFEDMQCQSGEEO8YSF5WA",
"credits": 2,
"remainingCredits": 1480582,
"duration": 33
}{
"error": true,
"status": 400,
"message": "Bad request. Typically due to bad input parameters or unreachable input URLs (e.g., access restrictions like login or password)."
}{
"error": true,
"status": 401,
"message": "Unauthorized. Authentication is required and has failed or has not yet been provided."
}{
"error": true,
"status": 402,
"message": "Not enough credits."
}{
"error": true,
"status": 403,
"message": "Access forbidden for input URL."
}{
"error": true,
"status": 404,
"message": "The requested resource could not be found."
}{
"error": true,
"status": 408,
"message": "The server timed out waiting for the request."
}{
"error": true,
"status": 429,
"message": "Too many requests in a given time period."
}{
"error": true,
"status": 441,
"message": "Invalid Password. Password protected document."
}{
"error": true,
"status": 442,
"message": "Input document is damaged or of incorrect type."
}{
"error": true,
"status": 443,
"message": "Permissions. The operation is prohibited by document security settings."
}{
"error": true,
"status": 444,
"message": "Profiles parsing error. Please ensure that the configuration is supported."
}{
"error": true,
"status": 445,
"message": "Timeout error. For large documents, use asynchronous mode (async=true) and check status via /job/check."
}{
"error": true,
"status": 446,
"message": "Some files required for conversion are missing."
}{
"error": true,
"status": 447,
"message": "Invalid template."
}{
"error": true,
"status": 448,
"message": "Invalid URL or HTML. Ensure the provided URL is valid and accessible."
}{
"error": true,
"status": 449,
"message": "Invalid index range. Page index is out of range."
}{
"error": true,
"status": 450,
"message": "Invalid page range specified."
}{
"error": true,
"status": 452,
"message": "Invalid URL."
}{
"error": true,
"status": 454,
"message": "Invalid parameters."
}{
"error": true,
"status": 500,
"message": "Something went wrong. Please try again or contact support."
}Full reference: Upload File from URL → API Reference — all parameters, response fields, and limits.
Authorizations
Body
application/json
URL to the source file url attribute.
File name for generated output.
HTTP auth user name if required to access source URL.
HTTP auth password if required to access source URL.
Response
Success.
Status of the API response.
Example:
"success"
Descriptive message for the response status.
Example:
"Success"
URL to the output file.
Example:
"https://pdf-temp-files.s3.us-west-2.amazonaws.com/output.pdf"
Unique identifier for the job.
Example:
"6YSZD3U872ZYYFEDMQCQSGEEO8YSF5WA"
Credits used for this operation.
Example:
2
Credits remaining after this operation.
Example:
1480582
Time taken to complete the request, in milliseconds.
Example:
33
Was this page helpful?
⌘I