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"

Render Combined Multi-Page Video#

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: {
      "page1@title": "Intro",
      "page2@title": "Features",
      "page3@title": "CTA",
    },
    response: {
      type: "url",
      format: "webm",
      includePages: [1, 2, 3],
    },
    videoOptions: {
      combinePages: true,
      pageTransition: "fade",
      pageTransitionDuration: 0.5,
      muted: true,
    },
  }),
});

const data = await response.json();
// { data: { content: "https://.../combined.webm", ... } }

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" }

Ready to automate?

Start rendering images, PDFs and videos from your templates in under 2 minutes. Free plan, no credit card.

Get your API key
  • Image, PDF and video generation via API
  • Visual editor with AI and smart layouts
  • Zapier, Make, MCP and 50+ integrations
  • White-label embed for your own app
  • 60 free renders — no credit card required