Skip to main content
Generate static code from a Figma frame for an application
curl --request POST \
  --url https://sapi.withsutro.com/applications/{applicationId}/figma/generate-static-code \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --header 'x-sutro-api-client: <api-key>' \
  --data '
{
  "fileKey": "<string>",
  "frameId": "<string>",
  "accessToken": "<string>"
}
'
import requests

url = "https://sapi.withsutro.com/applications/{applicationId}/figma/generate-static-code"

payload = {
    "fileKey": "<string>",
    "frameId": "<string>",
    "accessToken": "<string>"
}
headers = {
    "Authorization": "Bearer <token>",
    "x-sutro-api-client": "<api-key>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
const options = {
  method: 'POST',
  headers: {
    Authorization: 'Bearer <token>',
    'x-sutro-api-client': '<api-key>',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({fileKey: '<string>', frameId: '<string>', accessToken: '<string>'})
};

fetch('https://sapi.withsutro.com/applications/{applicationId}/figma/generate-static-code', options)
  .then(res => res.json())
  .then(res => console.log(res))
  .catch(err => console.error(err));
<?php

$curl = curl_init();

curl_setopt_array($curl, [
  CURLOPT_URL => "https://sapi.withsutro.com/applications/{applicationId}/figma/generate-static-code",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_POSTFIELDS => json_encode([
    'fileKey' => '<string>',
    'frameId' => '<string>',
    'accessToken' => '<string>'
  ]),
  CURLOPT_HTTPHEADER => [
    "Authorization: Bearer <token>",
    "Content-Type: application/json",
    "x-sutro-api-client: <api-key>"
  ],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://sapi.withsutro.com/applications/{applicationId}/figma/generate-static-code"

	payload := strings.NewReader("{\n  \"fileKey\": \"<string>\",\n  \"frameId\": \"<string>\",\n  \"accessToken\": \"<string>\"\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Authorization", "Bearer <token>")
	req.Header.Add("x-sutro-api-client", "<api-key>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.post("https://sapi.withsutro.com/applications/{applicationId}/figma/generate-static-code")
  .header("Authorization", "Bearer <token>")
  .header("x-sutro-api-client", "<api-key>")
  .header("Content-Type", "application/json")
  .body("{\n  \"fileKey\": \"<string>\",\n  \"frameId\": \"<string>\",\n  \"accessToken\": \"<string>\"\n}")
  .asString();
require 'uri'
require 'net/http'

url = URI("https://sapi.withsutro.com/applications/{applicationId}/figma/generate-static-code")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["x-sutro-api-client"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"fileKey\": \"<string>\",\n  \"frameId\": \"<string>\",\n  \"accessToken\": \"<string>\"\n}"

response = http.request(request)
puts response.read_body
{
  "success": true
}

Authorizations

Authorization
string
header
required

Builder authentication and authorization

x-sutro-api-client
string
header
required

A unique identifier for the API Client making a request

Path Parameters

applicationId
string<uuid>
required

Body

application/json
fileKey
string
required

The Figma file key

Minimum string length: 1
frameId
string
required

The Figma frame ID to generate code from

Minimum string length: 1
accessToken
string
required

Figma personal access token

Minimum string length: 1

Response

Generation job has been queued

success
boolean
required

Whether the job was successfully queued