Knowledge Hub


Intro

Especially for high volume tasks, it might be useful to generate videos through the part.io API. In essence you can achieve everything that you do with the Graph Editor with the API as well - and vice versa. This documentation therefore covers mainly the technical aspects of calling the API. For an explanation of the different video editing elements you might want to use, please refer to the 'Basic Elements' described as well in this Knowledge Hub.

Authentication

Before using the API, you need to create a new API token. Once you have logged on, you can do this on the api settings page with just one click. ONce you have done that, the API is ready to use. Each request you send to the API needs an 'Authorization' header with the value 'Bearer' followed by the token.

Submitting a Job

Submitting a Job is really easy. All you need to do is to post a JSON object to https://api.part.io/jobs . This JSON objects needs to contain the 'Bearer' mentioned above and the job description - which is is basically the compiled information what the jobs is supposed to do. This call returns a Job ID: {"id":"DPcM0BJV"}

Example Call:

curl 'https://api.part.io/job' \
  -H 'authorization: Bearer at_xxxxx' \
  -H 'content-type: application/json' \
  --data-raw '{ "nodes": [ { "id": "0XuOdadtQ2", "type": "Maps",\n\t\t\t"inputs": {}, "params": {"duration": "00:00:20", "position": "Weinheim"}  } ], "output": {  "test": true, "type": "mp4","test": false,"fps": 25,"width": 640,"height": 360,"duration": "00:00:20","name": "","node": "0XuOdadtQ2" } }'

Checking a Jobs status

Once the Job is submitted to part.io, you need to check the status in order to get the finshed video. In order to do this, do a GET request to https://api.part.io/job?id=JOBID . As long as the Job is not finished you will get a field "status" with the value 'queued'. Once the JOb is finished this value changes to 'done' and you also get a field 'url' containing the link where you can access the vidoe.

Example Call:

curl 'https://api.part.io/job?id=DPcM0BJV' \
   -H 'authorization: Bearer at_xxxxx'

Example Response:

{"jobs":[{"id":"DPcM0BJV","status":"done","job":"{ \"nodes\": [  { \"id\": \"0XuOdadtQ2\", \"type\": \"Maps\", \"inputs\": {}, \"params\": { \"duration\": \"00:00:20\", \"position\": \"Weinheim\" } ], \"output\": { \"type\": \"mp4\", \"test\": false, \"fps\": 25, \"width\": 640, \"height\": 360,\"duration\": \"00:00:20\", \"name\": \"\", \"node\": \"0XuOdadtQ2\" } }","name":"","created":1657205778928,"url":"https://...."}

Uploading Assets

Besides submitting Jobs, you can also upload assets directly to the part.io repository. In order to do this, you need to do a POST call to https://api.part.io/asset with a JSON object containing the field 'filename' and 'contentType'. The content type should be an mime-type (e.g. video/mp4).

The API will then return an JSON object with an 'url' field containing a signed URL. You can then upload the file using a PUT to the returned URL.

Example Call:

curl 'https://api.part.io/job' \
  -H 'authorization: Bearer at_xxxxx' \
  -H 'content-type: application/json' \
  --data-raw '{"filename":"testfile.mp4", "contentType": "video/mp4"}'