API Documentation

Extract metadata from files using our simple and powerful API. Get started with your API key and start analyzing files programmatically.

Authentication

All API requests require an API key. You can provide it in two ways:

1. In the request header:

X-API-Key: YOUR_API_KEY_HERE

2. As a query parameter:

?key=YOUR_API_KEY_HERE

Extract Metadata

POST https://exiftools.com/api/v1/extract

Extract metadata from a file using a direct file upload, a URL, or a base64 data URL. Results are returned immediately (synchronous processing). A check endpoint is also available for status verification if needed.

Request Parameters

{
  "file": "binary_file_data", // Option 1: direct file upload
  "url": "https://example.com/image.jpg", // Option 2: URL. Can be passed as POST body or query string parameter
  "data_url": "data:image/jpeg;base64,/9j/4AAQ..." // Option 3: base64 data URL
  // Provide exactly one of the above
}

Example Response

{
  "success": true,
  "status": "completed",
  "fileName": "image.jpg",
  "uuid": "123e4567-e89b-12d3-a456-426614174000"
  // ... 
  "metadata": {
    "exif": {
      "Make": "Canon",
      "Model": "EOS R5",
      "DateTimeOriginal": "2024:03:15 10:30:00",
      "ExposureTime": "1/1000",
      "FNumber": "2.8",
      "ISO": "100"
    },
    "iptc": {
      "Creator": "John Doe",
      "Copyright": "© 2024"
    }
    // ... more metadata
  }
}

Error Responses

400 Bad Request

{
  "success": false,
  "error": "Invalid request parameters"
}

401 Unauthorized

{
  "success": false,
  "error": "Invalid API key"
}

500 Internal Server Error

{
  "success": false,
  "error": "An error occurred while processing your request"
}

Get Extraction Results

GET https://exiftools.com/api/v1/extract/{uuid}

Retrieve the metadata extraction results for a specific UUID. Use this endpoint to check the status and get results after submitting a file or URL for processing. API key is optional - if provided, results are filtered to the authenticated user's extractions.

Request Parameters

{
  "uuid": "required", // The UUID returned from the extract endpoint
  "X-API-Key": "optional" // API key in header, or use ?key=YOUR_API_KEY
}

Example Response (Completed)

{
  "success": true,
  "status": "completed"
  "filename": "image.jpg",
  // ... 
  "metadata": {
    "exif": {
      "Make": "Canon",
      "Model": "EOS R5",
      "DateTimeOriginal": "2024:03:15 10:30:00",
      "ExposureTime": "1/1000",
      "FNumber": "2.8",
      "ISO": "100"
    },
    "iptc": {
      "Creator": "John Doe",
      "Copyright": "© 2024"
    }
    // ... more metadata
  },
}

Error Responses

401 Unauthorized

{
  "success": false,
  "error": "Invalid API key"
}

Only returned when an invalid API key is provided

404 Not Found

{
  "success": false,
  "error": "No extraction found with the given UUID."
}

Remove Metadata

POST https://exiftools.com/api/v1/remove

Remove all metadata from a file including EXIF data, GPS location, IPTC, XMP, and other sensitive information. Upload a file directly, provide a URL, or send a base64 data URL to process. Receive a cleaned version without any embedded metadata. The cleaned file is available for download via the returned URL.

Request Parameters

{
  "file": "binary_file_data", // Option 1: direct file upload
  "url": "https://example.com/image.jpg", // Option 2: URL. Can be passed as POST body or query string parameter
  "data_url": "data:image/jpeg;base64,/9j/4AAQ..." // Option 3: base64 data URL
  // Provide exactly one of the above
}

Example Response

{
  "success": true,
  "status": "completed",
  "uuid": "123e4567-e89b-12d3-a456-426614174000",
  "downloadUrl": "https://exiftools.com/download-cleaned/123e4567-e89b-12d3-a456-426614174000"
}

The downloadUrl provides a direct link to download the cleaned file with all metadata removed. The file will be available for download for 24 hours.

Error Responses

500 Internal Server Error

{
  "success": false,
  "error": "An error occurred while processing your request"
}

Code Examples

# File Upload - Using header
curl -X POST https://exiftools.com/api/v1/extract \
-H "X-API-Key: YOUR_API_KEY_HERE" \
-F "[email protected]"

# File Upload - Using query parameter
curl -X POST "https://exiftools.com/api/v1/extract?key=YOUR_API_KEY_HERE" \
-F "[email protected]"

# URL Processing - Using header
curl -X POST https://exiftools.com/api/v1/extract \
-H "X-API-Key: YOUR_API_KEY_HERE" \
-H "Content-Type: application/json" \
-d '{"url": "https://example.com/image.jpg"}'

# URL Processing - Using query parameter
curl -X POST "https://exiftools.com/api/v1/extract?key=YOUR_API_KEY_HERE" \
-H "Content-Type: application/json" \
-d '{"url": "https://example.com/image.jpg"}'

# Data URL (base64) - encode a local file inline
curl -X POST https://exiftools.com/api/v1/extract \
-H "X-API-Key: YOUR_API_KEY_HERE" \
-H "Content-Type: application/json" \
-d "{\"data_url\": \"data:image/jpeg;base64,$(base64 -i image.jpg)\"}"

# Get results by UUID (no API key required)
curl -X GET https://exiftools.com/api/v1/extract/123e4567-e89b-12d3-a456-426614174000

# Response (immediate results)
{
  "success": true,
  "status": "completed",
  "fileName": "image.jpg",
  "uuid": "123e4567-e89b-12d3-a456-426614174000"
  # ...
  "metadata": {
    "exif": {
      "Make": "Canon",
      "Model": "EOS R5",
      "DateTimeOriginal": "2024:03:15 10:30:00",
      "ExposureTime": "1/1000",
      "FNumber": "2.8",
      "ISO": "100"
    },
    "File" : {
      "Name" : "image.jpg",
      "Size" : 123456,
      "Type" : "image/jpeg"
    }
    # ... more metadata
  }
}

# Remove Metadata - File Upload - Using header
curl -X POST https://exiftools.com/api/v1/remove \
  -H "X-API-Key: YOUR_API_KEY_HERE" \
  -F "[email protected]"

# Remove Metadata - File Upload - Using query parameter
curl -X POST "https://exiftools.com/api/v1/remove?key=YOUR_API_KEY_HERE" \
  -F "[email protected]"

# Remove Metadata - URL Processing - Using header
curl -X POST https://exiftools.com/api/v1/remove \
  -H "X-API-Key: YOUR_API_KEY_HERE" \
  -H "Content-Type: application/json" \
  -d '{"url": "https://example.com/image.jpg"}'

# Remove Metadata - URL Processing - Using query parameter
curl -X POST "https://exiftools.com/api/v1/remove?key=YOUR_API_KEY_HERE" \
  -H "Content-Type: application/json" \
  -d '{"url": "https://example.com/image.jpg"}'

# Remove Metadata - Data URL (base64)
curl -X POST https://exiftools.com/api/v1/remove \
  -H "X-API-Key: YOUR_API_KEY_HERE" \
  -H "Content-Type: application/json" \
  -d "{\"data_url\": \"data:image/jpeg;base64,$(base64 -i image.jpg)\"}"

# Response
{
  "success": true,
  "status": "completed",
  "uuid": "123e4567-e89b-12d3-a456-426614174000",
  "downloadUrl": "https://exiftools.com/download-cleaned/123e4567-e89b-12d3-a456-426614174000"
}
import requests

# File Upload - Using header
url = "https://exiftools.com/api/v1/extract"
headers = {
    "X-API-Key": "YOUR_API_KEY_HERE"
}
files = {
    "file": open("image.jpg", "rb")
}
response = requests.post(url, headers=headers, files=files)

# File Upload - Using query parameter
url = "https://exiftools.com/api/v1/extract?key=YOUR_API_KEY_HERE"
files = {
    "file": open("image.jpg", "rb")
}
response = requests.post(url, files=files)

# URL Processing - Using header
url = "https://exiftools.com/api/v1/extract"
headers = {
    "X-API-Key": "YOUR_API_KEY_HERE",
    "Content-Type": "application/json"
}
data = {
    "url": "https://example.com/image.jpg"
}
response = requests.post(url, headers=headers, json=data)

# URL Processing - Using query parameter
url = "https://exiftools.com/api/v1/extract?key=YOUR_API_KEY_HERE"
headers = {
    "Content-Type": "application/json"
}
data = {
    "url": "https://example.com/image.jpg"
}
response = requests.post(url, headers=headers, json=data)

# Data URL (base64) - encode a local file
import base64
with open("image.jpg", "rb") as f:
    encoded = base64.b64encode(f.read()).decode("utf-8")
url = "https://exiftools.com/api/v1/extract"
headers = {
    "X-API-Key": "YOUR_API_KEY_HERE",
    "Content-Type": "application/json"
}
data = {
    "data_url": f"data:image/jpeg;base64,{encoded}"
}
response = requests.post(url, headers=headers, json=data)

# Get results by UUID (no API key required)
response = requests.get('https://exiftools.com/api/v1/extract/123e4567-e89b-12d3-a456-426614174000')
metadata = response.json()

# Remove Metadata - File Upload - Using header
url = "https://exiftools.com/api/v1/remove"
headers = {
    "X-API-Key": "YOUR_API_KEY_HERE"
}
files = {
    "file": open("image.jpg", "rb")
}
response = requests.post(url, headers=headers, files=files)
result = response.json()
# Download the cleaned file
download_url = result['downloadUrl']
cleaned_file = requests.get(download_url)
with open("image_cleaned.jpg", "wb") as f:
    f.write(cleaned_file.content)

# Remove Metadata - File Upload - Using query parameter
url = "https://exiftools.com/api/v1/remove?key=YOUR_API_KEY_HERE"
files = {
    "file": open("image.jpg", "rb")
}
response = requests.post(url, files=files)
result = response.json()

# Remove Metadata - URL Processing - Using header
url = "https://exiftools.com/api/v1/remove"
headers = {
    "X-API-Key": "YOUR_API_KEY_HERE",
    "Content-Type": "application/json"
}
data = {
    "url": "https://example.com/image.jpg"
}
response = requests.post(url, headers=headers, json=data)
result = response.json()

# Remove Metadata - URL Processing - Using query parameter
url = "https://exiftools.com/api/v1/remove?key=YOUR_API_KEY_HERE"
headers = {
    "Content-Type": "application/json"
}
data = {
    "url": "https://example.com/image.jpg"
}
response = requests.post(url, headers=headers, json=data)
result = response.json()

# Remove Metadata - Data URL (base64)
import base64
with open("image.jpg", "rb") as f:
    encoded = base64.b64encode(f.read()).decode("utf-8")
url = "https://exiftools.com/api/v1/remove"
headers = {
    "X-API-Key": "YOUR_API_KEY_HERE",
    "Content-Type": "application/json"
}
data = {
    "data_url": f"data:image/jpeg;base64,{encoded}"
}
response = requests.post(url, headers=headers, json=data)
result = response.json()
# Download cleaned file
cleaned_file = requests.get(result['downloadUrl'])
with open("image_cleaned.jpg", "wb") as f:
    f.write(cleaned_file.content)
// File Upload - Using header
const formData = new FormData();
formData.append('file', fileInput.files[0]);

fetch('https://exiftools.com/api/v1/extract', {
    method: 'POST',
    headers: {
        'X-API-Key': 'YOUR_API_KEY_HERE'
    },
    body: formData
})
.then(response => response.json())
.then(data => console.log(data));

// File Upload - Using query parameter
const formData2 = new FormData();
formData2.append('file', fileInput.files[0]);

fetch('https://exiftools.com/api/v1/extract?key=YOUR_API_KEY_HERE', {
    method: 'POST',
    body: formData2
})
.then(response => response.json())
.then(data => console.log(data));

// URL Processing - Using header
fetch('https://exiftools.com/api/v1/extract', {
    method: 'POST',
    headers: {
        'X-API-Key': 'YOUR_API_KEY_HERE',
        'Content-Type': 'application/json'
    },
    body: JSON.stringify({
        url: 'https://example.com/image.jpg'
    })
})
.then(response => response.json())
.then(data => console.log(data));

// URL Processing - Using query parameter
fetch('https://exiftools.com/api/v1/extract?key=YOUR_API_KEY_HERE', {
    method: 'POST',
    headers: {
        'Content-Type': 'application/json'
    },
    body: JSON.stringify({
        url: 'https://example.com/image.jpg'
    })
})
.then(response => response.json())
.then(data => console.log(data));

// Data URL (base64) - from a File input or canvas
const reader = new FileReader();
reader.onload = () => {
    fetch('https://exiftools.com/api/v1/extract', {
        method: 'POST',
        headers: {
            'X-API-Key': 'YOUR_API_KEY_HERE',
            'Content-Type': 'application/json'
        },
        body: JSON.stringify({
            data_url: reader.result // e.g. "data:image/jpeg;base64,..."
        })
    })
    .then(response => response.json())
    .then(data => console.log(data));
};
reader.readAsDataURL(fileInput.files[0]);

// Get results by UUID (no API key required)
fetch('https://exiftools.com/api/v1/extract/123e4567-e89b-12d3-a456-426614174000')
.then(response => response.json())
.then(data => console.log(data));

// Remove Metadata - File Upload - Using header
const removeFormData = new FormData();
removeFormData.append('file', fileInput.files[0]);

fetch('https://exiftools.com/api/v1/remove', {
    method: 'POST',
    headers: {
        'X-API-Key': 'YOUR_API_KEY_HERE'
    },
    body: removeFormData
})
.then(response => response.json())
.then(data => {
    // Download the cleaned file
    window.location.href = data.downloadUrl;
});

// Remove Metadata - File Upload - Using query parameter
const removeFormData2 = new FormData();
removeFormData2.append('file', fileInput.files[0]);

fetch('https://exiftools.com/api/v1/remove?key=YOUR_API_KEY_HERE', {
    method: 'POST',
    body: removeFormData2
})
.then(response => response.json())
.then(data => console.log(data));

// Remove Metadata - URL Processing - Using header
fetch('https://exiftools.com/api/v1/remove', {
    method: 'POST',
    headers: {
        'X-API-Key': 'YOUR_API_KEY_HERE',
        'Content-Type': 'application/json'
    },
    body: JSON.stringify({
        url: 'https://example.com/image.jpg'
    })
})
.then(response => response.json())
.then(data => {
    window.location.href = data.downloadUrl;
});

// Remove Metadata - URL Processing - Using query parameter
fetch('https://exiftools.com/api/v1/remove?key=YOUR_API_KEY_HERE', {
    method: 'POST',
    headers: {
        'Content-Type': 'application/json'
    },
    body: JSON.stringify({
        url: 'https://example.com/image.jpg'
    })
})
.then(response => response.json())
.then(data => console.log(data));

// Remove Metadata - Data URL (base64)
const reader2 = new FileReader();
reader2.onload = () => {
    fetch('https://exiftools.com/api/v1/remove', {
        method: 'POST',
        headers: {
            'X-API-Key': 'YOUR_API_KEY_HERE',
            'Content-Type': 'application/json'
        },
        body: JSON.stringify({
            data_url: reader2.result
        })
    })
    .then(response => response.json())
    .then(data => {
        window.location.href = data.downloadUrl;
    });
};
reader2.readAsDataURL(fileInput.files[0]);
// File Upload - Using header
$curl = curl_init();
$file = new CURLFile('/path/to/image.jpg', 'image/jpeg', 'image.jpg');

curl_setopt_array($curl, [
    CURLOPT_URL => 'https://exiftools.com/api/v1/extract',
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_POST => true,
    CURLOPT_POSTFIELDS => [
        'file' => $file
    ],
    CURLOPT_HTTPHEADER => [
        'X-API-Key: YOUR_API_KEY_HERE'
    ]
]);

$response = curl_exec($curl);
$metadata = json_decode($response, true);
curl_close($curl);

// File Upload - Using query parameter
$curl = curl_init();
$file = new CURLFile('/path/to/image.jpg', 'image/jpeg', 'image.jpg');

curl_setopt_array($curl, [
    CURLOPT_URL => 'https://exiftools.com/api/v1/extract?key=YOUR_API_KEY_HERE',
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_POST => true,
    CURLOPT_POSTFIELDS => [
        'file' => $file
    ]
]);

$response = curl_exec($curl);
$metadata = json_decode($response, true);
curl_close($curl);

// URL Processing - Using header
$curl = curl_init();
$data = json_encode(['url' => 'https://example.com/image.jpg']);

curl_setopt_array($curl, [
    CURLOPT_URL => 'https://exiftools.com/api/v1/extract',
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_POST => true,
    CURLOPT_POSTFIELDS => $data,
    CURLOPT_HTTPHEADER => [
        'X-API-Key: YOUR_API_KEY_HERE',
        'Content-Type: application/json'
    ]
]);

$response = curl_exec($curl);
$metadata = json_decode($response, true);
curl_close($curl);

// URL Processing - Using query parameter
$curl = curl_init();
$data = json_encode(['url' => 'https://example.com/image.jpg']);

curl_setopt_array($curl, [
    CURLOPT_URL => 'https://exiftools.com/api/v1/extract?key=YOUR_API_KEY_HERE',
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_POST => true,
    CURLOPT_POSTFIELDS => $data,
    CURLOPT_HTTPHEADER => [
        'Content-Type: application/json'
    ]
]);

$response = curl_exec($curl);
$metadata = json_decode($response, true);
curl_close($curl);

// Data URL (base64) - encode a local file
$curl = curl_init();
$base64 = base64_encode(file_get_contents('/path/to/image.jpg'));
$data = json_encode(['data_url' => 'data:image/jpeg;base64,' . $base64]);

curl_setopt_array($curl, [
    CURLOPT_URL => 'https://exiftools.com/api/v1/extract',
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_POST => true,
    CURLOPT_POSTFIELDS => $data,
    CURLOPT_HTTPHEADER => [
        'X-API-Key: YOUR_API_KEY_HERE',
        'Content-Type: application/json'
    ]
]);

$response = curl_exec($curl);
$metadata = json_decode($response, true);
curl_close($curl);

// Get results by UUID (no API key required)
$curl = curl_init();
curl_setopt_array($curl, [
    CURLOPT_URL => 'https://exiftools.com/api/v1/extract/123e4567-e89b-12d3-a456-426614174000',
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPGET => true
]);

$response = curl_exec($curl);
$metadata = json_decode($response, true);
curl_close($curl);

// Remove Metadata - File Upload - Using header
$curl = curl_init();
$file = new CURLFile('/path/to/image.jpg', 'image/jpeg', 'image.jpg');

curl_setopt_array($curl, [
    CURLOPT_URL => 'https://exiftools.com/api/v1/remove',
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_POST => true,
    CURLOPT_POSTFIELDS => [
        'file' => $file
    ],
    CURLOPT_HTTPHEADER => [
        'X-API-Key: YOUR_API_KEY_HERE'
    ]
]);

$response = curl_exec($curl);
$result = json_decode($response, true);
curl_close($curl);

// Download the cleaned file
$downloadUrl = $result['downloadUrl'];
$cleanedContent = file_get_contents($downloadUrl);
file_put_contents('image_cleaned.jpg', $cleanedContent);

// Remove Metadata - File Upload - Using query parameter
$curl = curl_init();
$file = new CURLFile('/path/to/image.jpg', 'image/jpeg', 'image.jpg');

curl_setopt_array($curl, [
    CURLOPT_URL => 'https://exiftools.com/api/v1/remove?key=YOUR_API_KEY_HERE',
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_POST => true,
    CURLOPT_POSTFIELDS => [
        'file' => $file
    ]
]);

$response = curl_exec($curl);
$result = json_decode($response, true);
curl_close($curl);

// Remove Metadata - URL Processing - Using header
$curl = curl_init();
$data = json_encode(['url' => 'https://example.com/image.jpg']);

curl_setopt_array($curl, [
    CURLOPT_URL => 'https://exiftools.com/api/v1/remove',
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_POST => true,
    CURLOPT_POSTFIELDS => $data,
    CURLOPT_HTTPHEADER => [
        'X-API-Key: YOUR_API_KEY_HERE',
        'Content-Type: application/json'
    ]
]);

$response = curl_exec($curl);
$result = json_decode($response, true);
curl_close($curl);

// Remove Metadata - URL Processing - Using query parameter
$curl = curl_init();
$data = json_encode(['url' => 'https://example.com/image.jpg']);

curl_setopt_array($curl, [
    CURLOPT_URL => 'https://exiftools.com/api/v1/remove?key=YOUR_API_KEY_HERE',
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_POST => true,
    CURLOPT_POSTFIELDS => $data,
    CURLOPT_HTTPHEADER => [
        'Content-Type: application/json'
    ]
]);

$response = curl_exec($curl);
$result = json_decode($response, true);
curl_close($curl);

// Remove Metadata - Data URL (base64)
$curl = curl_init();
$base64 = base64_encode(file_get_contents('/path/to/image.jpg'));
$data = json_encode(['data_url' => 'data:image/jpeg;base64,' . $base64]);

curl_setopt_array($curl, [
    CURLOPT_URL => 'https://exiftools.com/api/v1/remove',
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_POST => true,
    CURLOPT_POSTFIELDS => $data,
    CURLOPT_HTTPHEADER => [
        'X-API-Key: YOUR_API_KEY_HERE',
        'Content-Type: application/json'
    ]
]);

$response = curl_exec($curl);
$result = json_decode($response, true);
curl_close($curl);

// Download cleaned file
$cleanedContent = file_get_contents($result['downloadUrl']);
file_put_contents('image_cleaned.jpg', $cleanedContent);
require 'net/http'
require 'json'
require 'uri'

# File Upload - Using header
uri = URI('https://exiftools.com/api/v1/extract')
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true

request = Net::HTTP::Post.new(uri)
request['X-API-Key'] = 'YOUR_API_KEY_HERE'

# Create multipart form data
form_data = [['file', File.open('image.jpg', 'rb')]]
request.set_form(form_data, 'multipart/form-data')

response = http.request(request)
metadata = JSON.parse(response.body)

# File Upload - Using query parameter
uri = URI('https://exiftools.com/api/v1/extract?key=YOUR_API_KEY_HERE')
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true

request = Net::HTTP::Post.new(uri)
form_data = [['file', File.open('image.jpg', 'rb')]]
request.set_form(form_data, 'multipart/form-data')

response = http.request(request)
metadata = JSON.parse(response.body)

# URL Processing - Using header
uri = URI('https://exiftools.com/api/v1/extract')
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true

request = Net::HTTP::Post.new(uri)
request['X-API-Key'] = 'YOUR_API_KEY_HERE'
request['Content-Type'] = 'application/json'
request.body = { url: 'https://example.com/image.jpg' }.to_json

response = http.request(request)
metadata = JSON.parse(response.body)

# URL Processing - Using query parameter
uri = URI('https://exiftools.com/api/v1/extract?key=YOUR_API_KEY_HERE')
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true

request = Net::HTTP::Post.new(uri)
request['Content-Type'] = 'application/json'
request.body = { url: 'https://example.com/image.jpg' }.to_json

response = http.request(request)
metadata = JSON.parse(response.body)

# Data URL (base64) - encode a local file
require 'base64'
encoded = Base64.strict_encode64(File.binread('image.jpg'))
uri = URI('https://exiftools.com/api/v1/extract')
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true

request = Net::HTTP::Post.new(uri)
request['X-API-Key'] = 'YOUR_API_KEY_HERE'
request['Content-Type'] = 'application/json'
request.body = { data_url: "data:image/jpeg;base64,#{encoded}" }.to_json

response = http.request(request)
metadata = JSON.parse(response.body)

# Alternative using HTTParty gem (if available)
# require 'httparty'
# 
# # File Upload
# response = HTTParty.post('https://exiftools.com/api/v1/extract',
#   headers: { 'X-API-Key' => 'YOUR_API_KEY_HERE' },
#   body: { file: File.open('image.jpg', 'rb') }
# )
# 
# # URL Processing
# response = HTTParty.post('https://exiftools.com/api/v1/extract',
#   headers: { 
#     'X-API-Key' => 'YOUR_API_KEY_HERE',
#     'Content-Type' => 'application/json'
#   },
#   body: { url: 'https://example.com/image.jpg' }.to_json
# )

# Get results by UUID (no API key required)
uri = URI('https://exiftools.com/api/v1/extract/123e4567-e89b-12d3-a456-426614174000')
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true

request = Net::HTTP::Get.new(uri)
response = http.request(request)
metadata = JSON.parse(response.body)

# Remove Metadata - File Upload - Using header
uri = URI('https://exiftools.com/api/v1/remove')
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true

request = Net::HTTP::Post.new(uri)
request['X-API-Key'] = 'YOUR_API_KEY_HERE'

# Create multipart form data
form_data = [['file', File.open('image.jpg', 'rb')]]
request.set_form(form_data, 'multipart/form-data')

response = http.request(request)
result = JSON.parse(response.body)

# Download the cleaned file
download_uri = URI(result['downloadUrl'])
cleaned_file = Net::HTTP.get(download_uri)
File.write('image_cleaned.jpg', cleaned_file)

# Remove Metadata - File Upload - Using query parameter
uri = URI('https://exiftools.com/api/v1/remove?key=YOUR_API_KEY_HERE')
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true

request = Net::HTTP::Post.new(uri)
form_data = [['file', File.open('image.jpg', 'rb')]]
request.set_form(form_data, 'multipart/form-data')

response = http.request(request)
result = JSON.parse(response.body)

# Remove Metadata - URL Processing - Using header
uri = URI('https://exiftools.com/api/v1/remove')
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true

request = Net::HTTP::Post.new(uri)
request['X-API-Key'] = 'YOUR_API_KEY_HERE'
request['Content-Type'] = 'application/json'
request.body = { url: 'https://example.com/image.jpg' }.to_json

response = http.request(request)
result = JSON.parse(response.body)

# Remove Metadata - URL Processing - Using query parameter
uri = URI('https://exiftools.com/api/v1/remove?key=YOUR_API_KEY_HERE')
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true

request = Net::HTTP::Post.new(uri)
request['Content-Type'] = 'application/json'
request.body = { url: 'https://example.com/image.jpg' }.to_json

response = http.request(request)
result = JSON.parse(response.body)

# Remove Metadata - Data URL (base64)
require 'base64'
encoded = Base64.strict_encode64(File.binread('image.jpg'))
uri = URI('https://exiftools.com/api/v1/remove')
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true

request = Net::HTTP::Post.new(uri)
request['X-API-Key'] = 'YOUR_API_KEY_HERE'
request['Content-Type'] = 'application/json'
request.body = { data_url: "data:image/jpeg;base64,#{encoded}" }.to_json

response = http.request(request)
result = JSON.parse(response.body)

# Download cleaned file
download_uri = URI(result['downloadUrl'])
cleaned_file = Net::HTTP.get(download_uri)
File.write('image_cleaned.jpg', cleaned_file)