Limited Founders Deal — 5 TB for $8/month

Tutorials & How-To

API Integration Guide: Automate Your File Sharing

13 min read
API Integration Guide: Automate Your File Sharing

Automation transforms file sharing from manual task to seamless workflow. GetShared's API enables developers to integrate file operations into applications, automate processes, and build custom solutions. This guide covers API capabilities, authentication, and practical integration examples.

Why Use the GetShared API?

Manual file sharing works for occasional use. Automation makes sense when:

  • Repetitive tasks – Regular uploads, scheduled shares
  • Application integration – File storage within your apps
  • Custom workflows – Business-specific requirements
  • Scale – Processing thousands of files
  • Consistency – Enforcing standards across operations

API Overview

RESTful Design

GetShared's API follows REST conventions:

  • Standard HTTP methods (GET, POST, PUT, DELETE)
  • JSON request/response format
  • Predictable endpoint structure
  • Stateless authentication

Base URL

https://api.getshared.com/v1/

Core Endpoints

Endpoint Method Description
/files GET List files
/files POST Upload file
/files/{id} GET Get file details
/files/{id} DELETE Delete file
/folders GET/POST Manage folders
/shares GET/POST Manage share links
/shares/{id}/analytics GET Download analytics

Authentication

API Keys

Generate API keys in your account settings:

  1. Go to Settings → API
  2. Click "Generate New Key"
  3. Name your key (e.g., "Production Server")
  4. Copy and securely store the key

Using API Keys

Include in request headers:

Authorization: Bearer YOUR_API_KEY

Security Best Practices

  • Never commit API keys to code repositories
  • Use environment variables
  • Rotate keys periodically
  • Use separate keys for development/production
  • Enable two-factor authentication on accounts with API access

Common Operations

Uploading Files

// JavaScript/Node.js example
const FormData = require('form-data');
const fs = require('fs');

const form = new FormData();
form.append('file', fs.createReadStream('document.pdf'));
form.append('folder_id', 'abc123');

fetch('https://api.getshared.com/v1/files', {
  method: 'POST',
  headers: {
    'Authorization': `Bearer ${API_KEY}`
  },
  body: form
});

Creating Share Links

// Create password-protected, expiring share
fetch('https://api.getshared.com/v1/shares', {
  method: 'POST',
  headers: {
    'Authorization': `Bearer ${API_KEY}`,
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    file_id: 'file_123',
    password: 'secure-password',
    expires_at: '2026-02-28T00:00:00Z',
    download_limit: 5
  })
});

Retrieving Analytics

// Get download history for a share
fetch('https://api.getshared.com/v1/shares/share_123/analytics', {
  headers: {
    'Authorization': `Bearer ${API_KEY}`
  }
})
.then(res => res.json())
.then(data => {
  console.log(`Total downloads: ${data.total_downloads}`);
  data.downloads.forEach(d => {
    console.log(`${d.timestamp} - ${d.country}`);
  });
});

Integration Examples

1. Automated Backup Upload

Script that uploads daily backups:

#!/bin/bash
# Daily backup upload
DATE=$(date +%Y-%m-%d)
BACKUP_FILE="/backups/db_${DATE}.sql.gz"

curl -X POST https://api.getshared.com/v1/files \
  -H "Authorization: Bearer ${GETSHARED_API_KEY}" \
  -F "file=@${BACKUP_FILE}" \
  -F "folder_id=backups_folder_id"

See backup strategies for comprehensive backup strategies.

2. E-commerce Order Delivery

Automatically share digital products after purchase:

// After successful payment
async function deliverDigitalProduct(orderId, productFileId, customerEmail) {
  // Create time-limited share
  const share = await createShare({
    file_id: productFileId,
    expires_at: addDays(new Date(), 30),
    download_limit: 3
  });
  
  // Send email with download link
  await sendEmail({
    to: customerEmail,
    subject: 'Your download is ready',
    body: `Download your purchase: ${share.url}`
  });
  
  return share;
}

3. Client Portal Integration

Embed file sharing in your application:

// List client's files
app.get('/client/:id/files', async (req, res) => {
  const files = await getshared.listFiles({
    folder_id: clientFolders[req.params.id]
  });
  
  res.render('client-files', { files });
});

// Generate download links
app.get('/client/:id/files/:fileId/download', async (req, res) => {
  const share = await getshared.createShare({
    file_id: req.params.fileId,
    expires_at: addHours(new Date(), 24)
  });
  
  res.redirect(share.url);
});

Webhooks

Receive real-time notifications when events occur:

Available Events

  • file.uploaded – New file uploaded
  • file.downloaded – File downloaded via share
  • share.created – New share link created
  • share.accessed – Share link visited
  • share.expired – Share link expired

Webhook Configuration

  1. Go to Settings → API → Webhooks
  2. Add endpoint URL
  3. Select events to receive
  4. Copy signing secret for verification

Rate Limits

Plan Requests/Minute Uploads/Hour
Free 60 20
Pro 300 100
Team 1000 500
Enterprise Custom Custom

Rate limit headers are included in responses:

X-RateLimit-Limit: 300
X-RateLimit-Remaining: 299
X-RateLimit-Reset: 1643723400

Error Handling

API returns standard HTTP status codes:

  • 200 – Success
  • 400 – Bad request (check parameters)
  • 401 – Unauthorized (check API key)
  • 403 – Forbidden (insufficient permissions)
  • 404 – Not found
  • 429 – Rate limited
  • 500 – Server error

SDKs and Libraries

Official SDKs available for:

  • JavaScript/Node.js
  • Python
  • PHP
  • Ruby
  • Go

Community libraries for additional languages listed in our developer documentation.

Getting Started

  1. sign up for GetShared if you haven't already
  2. Generate API key in settings
  3. Review API documentation
  4. Start with simple operations (list files)
  5. Build up to complex integrations

Need help with integration? Our developer support team can assist with architecture questions and implementation guidance.

Share this article:

Related Articles

Ready to share files securely?

Join over 1 million users who trust GetShared. Get 20GB free storage with no credit card required.

Get Started Free