Skip to content

Integration Guide

Integrating Uploadista Cloud into your app requires two things:

  1. A backend auth endpoint that exchanges your API key for a JWT token
  2. A client SDK configured in uploadista-cloud mode

This guide covers the full setup with detailed examples for common frameworks and scenarios.

Understanding the auth flow helps you integrate Uploadista Cloud correctly:

1. Client SDK needs to upload a file
2. Client calls YOUR backend: GET /api/auth/token/:clientId
3. Your backend calls Uploadista Cloud with your API key
4. Uploadista Cloud returns a short-lived JWT token
5. Your backend forwards the token to the client
6. Client uses the token for all upload/flow requests
7. Token is cached and auto-refreshed before expiration

Your backend needs a single endpoint. The getAuthCredentials helper handles the token exchange with Uploadista Cloud:

app/api/auth/token/[clientId]/route.ts
import { getAuthCredentials } from '@uploadista/server/auth';
import { getServerSession } from 'next-auth'; // or your auth library
export const GET = async (req: Request, ctx: { params: Promise<{ clientId: string }> }) => {
// Protect the endpoint with your own auth
const session = await getServerSession();
if (!session) {
return Response.json({ error: "Unauthorized" }, { status: 401 });
}
const { clientId } = await ctx.params;
const response = await getAuthCredentials({
uploadistaClientId: clientId,
uploadistaApiKey: process.env.UPLOADISTA_API_KEY!,
});
if (!response.isValid) {
return Response.json({ error: response.error }, { status: 500 });
}
return Response.json(response.data);
};

Add these to your backend environment:

Terminal window
# Your Uploadista Cloud API key (from Settings > API Keys)
UPLOADISTA_API_KEY=upl_sk_...
import { UploadistaProvider, useUpload, useFlow } from "@uploadista/react";
function App() {
return (
<UploadistaProvider
storageId="your-storage-id"
auth={{
mode: 'uploadista-cloud',
authServerUrl: '/api/auth/token',
clientId: process.env.NEXT_PUBLIC_UPLOADISTA_CLIENT_ID!
}}
>
<FileUploader />
</UploadistaProvider>
);
}
// Simple upload
function FileUploader() {
const upload = useUpload({
onSuccess: (result) => {
console.log("File URL:", result.url);
},
});
return (
<div>
<input
type="file"
onChange={(e) => {
const file = e.target.files?.[0];
if (file) upload.upload(file);
}}
/>
{upload.isUploading && <progress value={upload.state.progress} max={100} />}
</div>
);
}
// Upload with flow processing
function ImageProcessor() {
const flow = useFlow({
flowConfig: {
flowId: "image-optimization",
storageId: "your-storage-id",
},
onSuccess: (outputs) => {
console.log("Processed files:", outputs);
},
});
return (
<div>
<input
type="file"
accept="image/*"
onChange={(e) => {
const file = e.target.files?.[0];
if (file) flow.upload(file);
}}
/>
{flow.isUploading && (
<div>
<progress value={flow.state.progress} max={100} />
{flow.state.currentNodeName && <p>Processing: {flow.state.currentNodeName}</p>}
</div>
)}
</div>
);
}

See the full React SDK reference for all hooks and components.

main.ts
import { createUploadistaPlugin } from "@uploadista/vue";
app.use(createUploadistaPlugin({
storageId: "your-storage-id",
auth: {
mode: 'uploadista-cloud',
authServerUrl: '/api/auth/token',
clientId: import.meta.env.VITE_UPLOADISTA_CLIENT_ID
}
}));
FileUploader.vue
<script setup lang="ts">
import { useUpload } from "@uploadista/vue";
const upload = useUpload({
onSuccess: (result) => {
console.log("File URL:", result.url);
},
});
function handleFileSelect(event: Event) {
const file = (event.target as HTMLInputElement).files?.[0];
if (file) upload.upload(file);
}
</script>
<template>
<div>
<input type="file" @change="handleFileSelect" />
<progress v-if="upload.isUploading" :value="upload.state.progress" max="100" />
</div>
</template>

See the full Vue SDK reference for all composables.

import { createUploadistaClient } from "@uploadista/expo";
const client = createUploadistaClient({
storageId: "your-storage-id",
auth: {
mode: 'uploadista-cloud',
authServerUrl: 'https://api.yourapp.com/auth/token',
clientId: 'your-client-id'
}
});
// Upload a file
const result = await client.upload(file);
console.log("File URL:", result.url);

See the full Expo SDK reference for mobile-specific features.

Flows created in the Uploadista Cloud dashboard are available to your client SDK by their flow ID.

  1. Go to Flows in your dashboard
  2. Click Create Flow
  3. Drag nodes from the sidebar (Input, Resize, Save, etc.)
  4. Connect nodes by dragging between handles
  5. Click each node to configure it (dimensions, format, storage)
  6. Click Test to verify with a sample file
  7. Save and Activate the flow

Once a flow is active, trigger it from your client with the flow ID:

import { useFlow } from "@uploadista/react";
function ProfilePictureUpload() {
const flow = useFlow({
flowConfig: {
flowId: "profile-picture-resize", // Flow ID from the dashboard
storageId: "your-storage-id",
},
onSuccess: (outputs) => {
// outputs contains the processed file URLs
updateUserAvatar(outputs.thumbnail.url);
},
});
return (
<input
type="file"
accept="image/*"
onChange={(e) => {
const file = e.target.files?.[0];
if (file) flow.upload(file);
}}
/>
);
}
FlowWhat it doesTypical nodes
Profile pictureResize + crop to square + save as WebPInput > Resize > Crop > Format Convert > Save
Product imagesGenerate thumbnail + full-size + optimizeInput > Resize (x2) > Optimize > Save (x2)
Document uploadValidate type + store securelyInput > Conditional > Save
Image galleryMultiple sizes + watermarkInput > Resize (x3) > Watermark > Save (x3)

If you’re already using the self-hosted Uploadista SDK and want to switch to Cloud:

Replace the direct auth config and baseUrl with uploadista-cloud mode:

<UploadistaProvider
baseUrl="https://your-server.com"
storageId="your-storage-id"
auth={{
mode: 'direct',
getCredentials: async () => ({
headers: { 'Authorization': `Bearer ${token}` }
})
mode: 'uploadista-cloud',
authServerUrl: '/api/auth/token',
clientId: 'your-client-id'
}}
>

Add a single GET /api/auth/token/:clientId endpoint as described in Backend Setup.

If you have code-defined flows, recreate them in the visual flow builder. The node types and configuration options are the same.

Update your storage IDs to match the ones created in the Uploadista Cloud dashboard.

  • Verify your UPLOADISTA_API_KEY is set correctly
  • Check that the clientId in the client config matches a valid storage
  • Ensure your auth endpoint is accessible from the client
  • The token may have expired — check that auto-refresh is working
  • Verify your auth endpoint returns the correct response format
  • Check browser console for CORS errors
  • Verify the flow is activated in the dashboard
  • Check that the flowId matches exactly (case-sensitive)
  • Ensure the storage ID in flowConfig exists in your account