Initiate a task
curl --request POST \
--url https://api.turbofiles.io/v1/tasks \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/vnd.api+json' \
--data '
{
"data": {
"type": "tasks",
"attributes": {
"format": {
"input": "image/png",
"output": "image/webp"
},
"settings": {
"resize": {
"width": 640,
"height": 640,
"max_width": 1280,
"max_height": 1280
}
}
},
"relationship": {
"input": {
"data": {
"type": "files",
"id": "<string>"
}
}
}
}
}
'import requests
url = "https://api.turbofiles.io/v1/tasks"
payload = { "data": {
"type": "tasks",
"attributes": {
"format": {
"input": "image/png",
"output": "image/webp"
},
"settings": { "resize": {
"width": 640,
"height": 640,
"max_width": 1280,
"max_height": 1280
} }
},
"relationship": { "input": { "data": {
"type": "files",
"id": "<string>"
} } }
} }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/vnd.api+json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/vnd.api+json'},
body: JSON.stringify({
data: {
type: 'tasks',
attributes: {
format: {input: 'image/png', output: 'image/webp'},
settings: {resize: {width: 640, height: 640, max_width: 1280, max_height: 1280}}
},
relationship: {input: {data: {type: 'files', id: '<string>'}}}
}
})
};
fetch('https://api.turbofiles.io/v1/tasks', 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://api.turbofiles.io/v1/tasks",
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([
'data' => [
'type' => 'tasks',
'attributes' => [
'format' => [
'input' => 'image/png',
'output' => 'image/webp'
],
'settings' => [
'resize' => [
'width' => 640,
'height' => 640,
'max_width' => 1280,
'max_height' => 1280
]
]
],
'relationship' => [
'input' => [
'data' => [
'type' => 'files',
'id' => '<string>'
]
]
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/vnd.api+json"
],
]);
$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://api.turbofiles.io/v1/tasks"
payload := strings.NewReader("{\n \"data\": {\n \"type\": \"tasks\",\n \"attributes\": {\n \"format\": {\n \"input\": \"image/png\",\n \"output\": \"image/webp\"\n },\n \"settings\": {\n \"resize\": {\n \"width\": 640,\n \"height\": 640,\n \"max_width\": 1280,\n \"max_height\": 1280\n }\n }\n },\n \"relationship\": {\n \"input\": {\n \"data\": {\n \"type\": \"files\",\n \"id\": \"<string>\"\n }\n }\n }\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/vnd.api+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://api.turbofiles.io/v1/tasks")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/vnd.api+json")
.body("{\n \"data\": {\n \"type\": \"tasks\",\n \"attributes\": {\n \"format\": {\n \"input\": \"image/png\",\n \"output\": \"image/webp\"\n },\n \"settings\": {\n \"resize\": {\n \"width\": 640,\n \"height\": 640,\n \"max_width\": 1280,\n \"max_height\": 1280\n }\n }\n },\n \"relationship\": {\n \"input\": {\n \"data\": {\n \"type\": \"files\",\n \"id\": \"<string>\"\n }\n }\n }\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.turbofiles.io/v1/tasks")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/vnd.api+json'
request.body = "{\n \"data\": {\n \"type\": \"tasks\",\n \"attributes\": {\n \"format\": {\n \"input\": \"image/png\",\n \"output\": \"image/webp\"\n },\n \"settings\": {\n \"resize\": {\n \"width\": 640,\n \"height\": 640,\n \"max_width\": 1280,\n \"max_height\": 1280\n }\n }\n },\n \"relationship\": {\n \"input\": {\n \"data\": {\n \"type\": \"files\",\n \"id\": \"<string>\"\n }\n }\n }\n }\n}"
response = http.request(request)
puts response.read_body{
"jsonapi": {
"version": "1.1"
},
"links": {
"self": "<string>"
},
"data": {
"type": "tasks",
"id": "<string>",
"attributes": {
"public": false,
"created_at": "2023-01-01T00:00:00.000000Z",
"updated_at": "2023-01-02T00:00:00.000000Z",
"settings": {},
"status": "COMPLETED",
"format": {
"input": "image/png",
"output": "image/webp"
},
"started_at": "2023-01-03T00:00:00.000000Z",
"processed_at": "2023-01-04T00:00:00.000000Z",
"processing_metadata": {}
},
"relationships": {
"input": {
"data": {
"type": "files",
"id": "<string>"
},
"links": {
"self": "<string>",
"related": "<string>"
}
},
"output": {
"data": {
"type": "files",
"id": "<string>"
},
"links": {
"self": "<string>",
"related": "<string>"
}
}
},
"links": {
"self": "<string>"
}
},
"included": [
{
"type": "files",
"id": "8fhd83jpk",
"attributes": {
"size": 504233,
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
},
"links": {
"self": "<string>",
"upload": "<string>",
"download": "<string>"
}
}
]
}Tasks
Create a task
POST
/
v1
/
tasks
Initiate a task
curl --request POST \
--url https://api.turbofiles.io/v1/tasks \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/vnd.api+json' \
--data '
{
"data": {
"type": "tasks",
"attributes": {
"format": {
"input": "image/png",
"output": "image/webp"
},
"settings": {
"resize": {
"width": 640,
"height": 640,
"max_width": 1280,
"max_height": 1280
}
}
},
"relationship": {
"input": {
"data": {
"type": "files",
"id": "<string>"
}
}
}
}
}
'import requests
url = "https://api.turbofiles.io/v1/tasks"
payload = { "data": {
"type": "tasks",
"attributes": {
"format": {
"input": "image/png",
"output": "image/webp"
},
"settings": { "resize": {
"width": 640,
"height": 640,
"max_width": 1280,
"max_height": 1280
} }
},
"relationship": { "input": { "data": {
"type": "files",
"id": "<string>"
} } }
} }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/vnd.api+json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/vnd.api+json'},
body: JSON.stringify({
data: {
type: 'tasks',
attributes: {
format: {input: 'image/png', output: 'image/webp'},
settings: {resize: {width: 640, height: 640, max_width: 1280, max_height: 1280}}
},
relationship: {input: {data: {type: 'files', id: '<string>'}}}
}
})
};
fetch('https://api.turbofiles.io/v1/tasks', 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://api.turbofiles.io/v1/tasks",
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([
'data' => [
'type' => 'tasks',
'attributes' => [
'format' => [
'input' => 'image/png',
'output' => 'image/webp'
],
'settings' => [
'resize' => [
'width' => 640,
'height' => 640,
'max_width' => 1280,
'max_height' => 1280
]
]
],
'relationship' => [
'input' => [
'data' => [
'type' => 'files',
'id' => '<string>'
]
]
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/vnd.api+json"
],
]);
$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://api.turbofiles.io/v1/tasks"
payload := strings.NewReader("{\n \"data\": {\n \"type\": \"tasks\",\n \"attributes\": {\n \"format\": {\n \"input\": \"image/png\",\n \"output\": \"image/webp\"\n },\n \"settings\": {\n \"resize\": {\n \"width\": 640,\n \"height\": 640,\n \"max_width\": 1280,\n \"max_height\": 1280\n }\n }\n },\n \"relationship\": {\n \"input\": {\n \"data\": {\n \"type\": \"files\",\n \"id\": \"<string>\"\n }\n }\n }\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/vnd.api+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://api.turbofiles.io/v1/tasks")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/vnd.api+json")
.body("{\n \"data\": {\n \"type\": \"tasks\",\n \"attributes\": {\n \"format\": {\n \"input\": \"image/png\",\n \"output\": \"image/webp\"\n },\n \"settings\": {\n \"resize\": {\n \"width\": 640,\n \"height\": 640,\n \"max_width\": 1280,\n \"max_height\": 1280\n }\n }\n },\n \"relationship\": {\n \"input\": {\n \"data\": {\n \"type\": \"files\",\n \"id\": \"<string>\"\n }\n }\n }\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.turbofiles.io/v1/tasks")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/vnd.api+json'
request.body = "{\n \"data\": {\n \"type\": \"tasks\",\n \"attributes\": {\n \"format\": {\n \"input\": \"image/png\",\n \"output\": \"image/webp\"\n },\n \"settings\": {\n \"resize\": {\n \"width\": 640,\n \"height\": 640,\n \"max_width\": 1280,\n \"max_height\": 1280\n }\n }\n },\n \"relationship\": {\n \"input\": {\n \"data\": {\n \"type\": \"files\",\n \"id\": \"<string>\"\n }\n }\n }\n }\n}"
response = http.request(request)
puts response.read_body{
"jsonapi": {
"version": "1.1"
},
"links": {
"self": "<string>"
},
"data": {
"type": "tasks",
"id": "<string>",
"attributes": {
"public": false,
"created_at": "2023-01-01T00:00:00.000000Z",
"updated_at": "2023-01-02T00:00:00.000000Z",
"settings": {},
"status": "COMPLETED",
"format": {
"input": "image/png",
"output": "image/webp"
},
"started_at": "2023-01-03T00:00:00.000000Z",
"processed_at": "2023-01-04T00:00:00.000000Z",
"processing_metadata": {}
},
"relationships": {
"input": {
"data": {
"type": "files",
"id": "<string>"
},
"links": {
"self": "<string>",
"related": "<string>"
}
},
"output": {
"data": {
"type": "files",
"id": "<string>"
},
"links": {
"self": "<string>",
"related": "<string>"
}
}
},
"links": {
"self": "<string>"
}
},
"included": [
{
"type": "files",
"id": "8fhd83jpk",
"attributes": {
"size": 504233,
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
},
"links": {
"self": "<string>",
"upload": "<string>",
"download": "<string>"
}
}
]
}Authorizations
Authentication token must be provided in the Authorization header using the Bearer scheme. Example: Authorization: Bearer your-api-key-or-token
Body
application/vnd.api+json
Show child attributes
Show child attributes
⌘I