API reference / Projects

Import a ZIP into a project

POST/v1/projects/{projectId}/package

Replaces every file of the project with the ZIP's files as a new version on the head of a variation: variation, or main when it is left out (404 not_found for a variation the project lacks). With expectedHeadVersionId, the head must still be that version (409 head_moved otherwise); without it, the version goes on whatever the head is when the import finishes. zipUploadId names a completed upload whose fileName ends in .zip (409 upload_incomplete before it is completed). The ZIP follows the same rules as a project import, including fontLicenseAccepted true when it contains font files. The request waits up to 50 seconds (Prefer: wait=N changes it, at most 50) and answers 201 with the version, or the import's error. A larger ZIP still importing then answers 202 with the import; get it until its status is succeeded or failed. At most 10 imports per workspace wait or run at once (409 import_limit). A ZIP whose files total more than the plan's project size (limits.maxProjectBytes in the usage) is refused with 403 project_too_large, unless the head it replaces is at least as large. Send an Idempotency-Key header (1 to 200 characters) to make retries safe: for 24 hours the same request with the same key answers with what the first one made, with the header Idempotent-Replayed: true; the same key with a different request is 422 idempotency_key_reused while what the first one made exists, and while the first request is still running 409 idempotency_key_in_use, except that the retry of a ZIP import waits for that import, as the first request does. A request that failed made nothing, so it can be sent again with its key.

Request

curl -s -X POST $BLITFRAME/projects/c1edf0fb-045f-4c8a-af93-6d5e6e554334/package \
  -H "Authorization: Bearer $BLITFRAME_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Prefer: wait=50" \
  -H "Idempotency-Key: c1dcd9b4-822c-dc78-383a-ebe93f22e513" \
  -d '{
    "zipUploadId": "8a1f0c2e-6b3d-4e59-a7c4-1d2e3f4a5b6c",
    "expectedHeadVersionId": "5c3d7a8e-2f41-4b6a-9d10-7e2f5a9c1b34",
    "fontLicenseAccepted": true
  }'
import os, requests

response = requests.post(
    f"{os.environ['BLITFRAME']}/projects/c1edf0fb-045f-4c8a-af93-6d5e6e554334/package",
    headers={
        "Authorization": f"Bearer {os.environ['BLITFRAME_API_KEY']}",
        "Prefer": "wait=50",
        "Idempotency-Key": "c1dcd9b4-822c-dc78-383a-ebe93f22e513",
    },
    json={
        "zipUploadId": "8a1f0c2e-6b3d-4e59-a7c4-1d2e3f4a5b6c",
        "expectedHeadVersionId": "5c3d7a8e-2f41-4b6a-9d10-7e2f5a9c1b34",
        "fontLicenseAccepted": True,
    },
)
print(response.json())
const response = await fetch(`${process.env.BLITFRAME}/projects/c1edf0fb-045f-4c8a-af93-6d5e6e554334/package`, {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.BLITFRAME_API_KEY}`,
    "Content-Type": "application/json",
    Prefer: "wait=50",
    "Idempotency-Key": "c1dcd9b4-822c-dc78-383a-ebe93f22e513",
  },
  body: JSON.stringify({
    zipUploadId: "8a1f0c2e-6b3d-4e59-a7c4-1d2e3f4a5b6c",
    expectedHeadVersionId: "5c3d7a8e-2f41-4b6a-9d10-7e2f5a9c1b34",
    fontLicenseAccepted: true,
  }),
});
console.log(await response.json());
<?php
$request = curl_init(getenv("BLITFRAME") . "/projects/c1edf0fb-045f-4c8a-af93-6d5e6e554334/package");
curl_setopt_array($request, [
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_CUSTOMREQUEST => "POST",
    CURLOPT_HTTPHEADER => [
        "Authorization: Bearer " . getenv("BLITFRAME_API_KEY"),
        "Content-Type: application/json",
        "Prefer: wait=50",
        "Idempotency-Key: c1dcd9b4-822c-dc78-383a-ebe93f22e513",
    ],
    CURLOPT_POSTFIELDS => '{
      "zipUploadId": "8a1f0c2e-6b3d-4e59-a7c4-1d2e3f4a5b6c",
      "expectedHeadVersionId": "5c3d7a8e-2f41-4b6a-9d10-7e2f5a9c1b34",
      "fontLicenseAccepted": true
    }',
]);
$response = curl_exec($request);
echo $response;
require "net/http"

uri = URI(ENV["BLITFRAME"] + '/projects/c1edf0fb-045f-4c8a-af93-6d5e6e554334/package')
request = Net::HTTP::Post.new(uri)
request["Authorization"] = "Bearer " + ENV["BLITFRAME_API_KEY"]
request["Content-Type"] = "application/json"
request['Prefer'] = 'wait=50'
request['Idempotency-Key'] = 'c1dcd9b4-822c-dc78-383a-ebe93f22e513'
request.body = '{
  "zipUploadId": "8a1f0c2e-6b3d-4e59-a7c4-1d2e3f4a5b6c",
  "expectedHeadVersionId": "5c3d7a8e-2f41-4b6a-9d10-7e2f5a9c1b34",
  "fontLicenseAccepted": true
}'
response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: uri.scheme == "https") { |http| http.request(request) }
puts response.body
package main

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

func main() {
	body := strings.NewReader(`{
	  "zipUploadId": "8a1f0c2e-6b3d-4e59-a7c4-1d2e3f4a5b6c",
	  "expectedHeadVersionId": "5c3d7a8e-2f41-4b6a-9d10-7e2f5a9c1b34",
	  "fontLicenseAccepted": true
	}`)
	request, err := http.NewRequest("POST", os.Getenv("BLITFRAME")+"/projects/c1edf0fb-045f-4c8a-af93-6d5e6e554334/package", body)
	if err != nil {
		panic(err)
	}
	request.Header.Set("Authorization", "Bearer "+os.Getenv("BLITFRAME_API_KEY"))
	request.Header.Set("Content-Type", "application/json")
	request.Header.Set("Prefer", "wait=50")
	request.Header.Set("Idempotency-Key", "c1dcd9b4-822c-dc78-383a-ebe93f22e513")
	response, err := http.DefaultClient.Do(request)
	if err != nil {
		panic(err)
	}
	defer response.Body.Close()
	text, _ := io.ReadAll(response.Body)
	fmt.Println(string(text))
}
using System.Net.Http.Headers;
using System.Text;

using var client = new HttpClient();
using var request = new HttpRequestMessage(HttpMethod.Post,
    Environment.GetEnvironmentVariable("BLITFRAME") + "/projects/c1edf0fb-045f-4c8a-af93-6d5e6e554334/package");
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("BLITFRAME_API_KEY"));
request.Headers.Add("Prefer", "wait=50");
request.Headers.Add("Idempotency-Key", "c1dcd9b4-822c-dc78-383a-ebe93f22e513");
request.Content = new StringContent(
    """
    {
      "zipUploadId": "8a1f0c2e-6b3d-4e59-a7c4-1d2e3f4a5b6c",
      "expectedHeadVersionId": "5c3d7a8e-2f41-4b6a-9d10-7e2f5a9c1b34",
      "fontLicenseAccepted": true
    }
    """, Encoding.UTF8, "application/json");
using var response = await client.SendAsync(request);
Console.WriteLine(await response.Content.ReadAsStringAsync());
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;

public class Example {
    public static void main(String[] args) throws Exception {
        var request = HttpRequest.newBuilder(URI.create(System.getenv("BLITFRAME") + "/projects/c1edf0fb-045f-4c8a-af93-6d5e6e554334/package"))
            .header("Authorization", "Bearer " + System.getenv("BLITFRAME_API_KEY"))
            .header("Content-Type", "application/json")
            .header("Prefer", "wait=50")
            .header("Idempotency-Key", "c1dcd9b4-822c-dc78-383a-ebe93f22e513")
            .method("POST", HttpRequest.BodyPublishers.ofString("""
                {
                  "zipUploadId": "8a1f0c2e-6b3d-4e59-a7c4-1d2e3f4a5b6c",
                  "expectedHeadVersionId": "5c3d7a8e-2f41-4b6a-9d10-7e2f5a9c1b34",
                  "fontLicenseAccepted": true
                }
                """))
            .build();
        var response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
        System.out.println(response.body());
    }
}

Path parameters

  • projectIdstring (uuid)required

Headers

  • AuthorizationBearer Blitframe API keyrequired

    API key from the developer console.

  • Preferstring
  • Idempotency-Keystring

    Optional. A unique key you choose for this one request, 1 to 200 characters, such as a new UUID. Send the same key again only to retry this request after a lost answer: the retry answers with what the first one made instead of doing it again. Use a new key for every other request; the key in the samples is only an example.

Body

application/json · required · ImportPackageRequest

  • zipUploadIdstring (uuid) or nullrequired
  • expectedHeadVersionIdstring (uuid) or null
  • fontLicenseAcceptedboolean

    Default false

  • variationstring or null

Try it

POST/v1/projects/{projectId}/package

Used for the requests you send from this page only. It is not saved.

This sends a real request to your workspace: a render spends render seconds, and a delete is final.

Response

Send the request to see the answer here.

Responses

  • 201 Created

application/json · VersionDto

  • idstring (uuid)
  • projectIdstring (uuid)
  • parentVersionIdstring (uuid) or null
  • numberinteger
  • messagestring
  • createdAtstring (date-time)
  • compositionCompositionDto or null
    CompositionDto fields
    • widthinteger
    • heightinteger
    • frameRatenumber
    • durationSecondsnumber
    • frameCountinteger
  • renderableboolean
  • problemsarray of string
  • warningsarray of string
  • soundtrackAudioTrack or null
    AudioTrack fields
    • pathstring
    • offsetSecondsnumber
  • textFittingBaselineVersionIdstring (uuid) or null
  • filesarray of FileDto or null
    FileDto fields
    • pathstring
    • sizeBytesinteger (int64)
    • contentTypestring
    • sha256string
  • namestring or null
  • 202 Accepted

application/json · ZipImportDto

  • idstring (uuid)
  • projectIdstring (uuid)
  • One of queued importing succeeded failed

  • versionIdstring (uuid) or null
  • errorApiError or null
    ApiError fields
    • codestring
    • messagestring
  • createdAtstring (date-time)
  • finishedAtstring (date-time) or null

Errors

  • 400 Bad Request
  • 401 Unauthorized
  • 403 Forbidden
  • 404 Not Found
  • 409 Conflict
  • 413 Payload Too Large
  • 422 Unprocessable Entity
  • 429 Too Many Requests
  • 503 Service Unavailable

application/json · ErrorResponse

  • ApiError fields
    • codestring
    • messagestring

Errors lists the error codes and says when to retry.