Examples

Code examples for common OAuth API requests


For workspace-specific endpoints, use the x-workspace-id header to target a specific workspace. If omitted, the first authorized workspace is used.

Get Current User#

const response = await fetch("https://api.orshot.com/v1/me", {
  headers: {
    Authorization: `Bearer ${accessToken}`,
  },
});

const user = await response.json();
// { id: "user_...", name: "John Doe", email: "john@example.com", ... }

List Templates#

const response = await fetch("https://api.orshot.com/v1/studio/templates", {
  headers: {
    Authorization: `Bearer ${accessToken}`,
    "x-workspace-id": "50", // Optional: target specific workspace
  },
});

const templates = await response.json();
// [{ id: "123", name: "Social Card", ... }, ...]

Render Studio Template#

const response = await fetch("https://api.orshot.com/v1/studio/render", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${accessToken}`,
    "Content-Type": "application/json",
    "x-workspace-id": "50", // Optional: target specific workspace
  },
  body: JSON.stringify({
    templateId: "123",
    modifications: [
      { name: "title", text: "Hello World" },
      { name: "logo", src: "https://example.com/logo.png" },
    ],
    response: {
      type: "url",
      format: "png",
    },
  }),
});

const { url } = await response.json();
// "https://cloud.orshot.com/renders/abc123.png"

Generate Image#

const response = await fetch("https://api.orshot.com/v1/generate", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${accessToken}`,
    "Content-Type": "application/json",
    "x-workspace-id": "50", // Optional: target specific workspace
  },
  body: JSON.stringify({
    template_id: "123",
    modifications: [
      { name: "title", text: "Hello World" },
      { name: "avatar", src: "https://example.com/photo.jpg" },
    ],
    response_type: "url",
  }),
});

const { url } = await response.json();
// "https://storage.orshot.com/renders/abc123.png"

Generate with Base64 Response#

const response = await fetch("https://api.orshot.com/v1/generate", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${accessToken}`,
    "Content-Type": "application/json",
    "x-workspace-id": "50", // Optional: target specific workspace
  },
  body: JSON.stringify({
    template_id: "123",
    modifications: [{ name: "title", text: "Hello World" }],
    response_type: "base64",
  }),
});

const { base64 } = await response.json();
// "data:image/png;base64,iVBORw0KGgo..."

Get Template Modifications#

const response = await fetch(
  "https://api.orshot.com/v1/studio/templates/123/modifications",
  {
    headers: {
      Authorization: `Bearer ${accessToken}`,
      "x-workspace-id": "50", // Optional: target specific workspace
    },
  },
);

const modifications = await response.json();
// [{ name: "title", type: "text" }, { name: "avatar", type: "image" }, ...]

Delete Template#

const response = await fetch(
  "https://api.orshot.com/v1/studio/templates/123/delete",
  {
    method: "DELETE",
    headers: {
      Authorization: `Bearer ${accessToken}`,
      "x-workspace-id": "50", // Optional: target specific workspace
    },
  },
);

const result = await response.json();
// { message: "Template successfully deleted", id: "123" }

All Set? Let's Start Automating

Get Your API Key →
  • Image, PDF and Video Generation via API
  • Canva like editor with AI and smart features
  • No-Code Integrations (Zapier, Make, n8n etc.)
  • Embed Orshot Studio in your app
  • Start Free. No credit card required. Cancel anytime.