Documentation

Quick Start Guide

This guide will help you get started with Get Pronto's asset hosting service in just a few minutes. You'll learn how to set up your account, install the SDK, and perform basic file operations.

Step 1: Create an Account

  1. Visit https://app.getpronto.io/signup to create your Get Pronto account
  2. Complete the registration form with your information
  3. Verify your email address by clicking the link sent to your inbox
  4. Log in to your new account

Step 2: Get Your API Key

  1. Navigate to the API Keys section in your dashboard
  2. Click Create New API Key
  3. Give your key a name (e.g., "Development")
  4. Copy your new API key and store it securely

Important: Your API key will only be shown once. Make sure to copy it to a secure location. For more information on API keys, see our Authentication guide.

Step 3: Install the SDK

Install the Get Pronto SDK using npm or yarn:

bash
# Using npm
npm install @getpronto-io/getpronto-sdk

# Using yarn
yarn add @getpronto-io/getpronto-sdk

Step 4: Initialize the SDK Client

Create and initialize a Get Pronto client with your API key:

javascript
import GetProntoClient from "@getpronto-io/getpronto-sdk";

// Initialize the client with your API key
const client = new GetProntoClient({
  apiKey: "YOUR_API_KEY"
});

Step 5: Upload Your First File

Now that you have the client set up, let's upload a file:

javascript

try {
  const result = await client.files.upload("./path/to/image.jpg");
  console.log("File uploaded successfully:", result.file);
} catch (error) {
  console.error("Upload failed:", error.message);
}

Step 6: List Your Files

Retrieve a list of your uploaded files:

javascript
try {
  const response = await client.files.list();
  console.log("Files:", response.files);
  console.log("Pagination:", response.pagination);
} catch (error) {
  console.error("Failed to list files:", error.message);
}

Step 7: Transform an Image

Get Pronto allows you to transform images on-the-fly. Here's how to generate a URL for a resized image:

javascript
// Get the ID of an uploaded image
const fileId = "YOUR_FILE_ID";

// Generate a URL for a resized, grayscale version of the image
const imageUrl = await client.images
  .transform(fileId)
  .resize(800, 600)
  .grayscale()
  .quality(90)
  .toURL();

console.log("Transformed image URL:", imageUrl);

// Use this URL in your application
document.getElementById('myImage').src = imageUrl;

Complete Example

Here's a complete example that ties everything together:

javascript
import GetProntoClient from "@getpronto-io/getpronto-sdk";

// Initialize the client
const client = new GetProntoClient({
  apiKey: "YOUR_API_KEY"
});

async function uploadAndTransform() {
  try {
    // Upload a file
    const uploadResult = await client.files.upload("./image.jpg");
    console.log("File uploaded:", uploadResult.file);
    
    // Get the file ID
    const fileId = uploadResult.file.id;
    
    // Generate a URL for the transformed image
    const transformedUrl = await client.images
      .transform(fileId)
      .resize(300, 200)
      .grayscale()
      .toURL();
    
    console.log("Transformed image URL:", transformedUrl);
    
    // List all files
    const listResult = await client.files.list();
    console.log("Total files:", listResult.pagination.totalCount);
    
    return {
      originalFile: uploadResult.file,
      transformedUrl
    };
  } catch (error) {
    console.error("Error:", error.message);
  }
}

// Run the example
uploadAndTransform();

Next Steps

Continue exploring our documentation with these related topics: