Τ-coder API v1
Τ-coder offers an HTTP API for image compression as detailed below as well as open source Python and Golang clients.
Base URL
https://taucoder.com/api/v1
Authentication
Prior to using the API you need to obtain and activate an API key. An API key can be requested using the form on the front page. The key can be activated following the link in the email you receive.
Τ-coder API uses HTTP Basic authentication scheme
curl -u "<YOUR-API-KEY>" https://taucoder.com/api/v1
Async API
All τ-coder API is an async and non-blocking. The API consists of two endpoints:submit one or more images for processing, and check status and retrieve results
Submit images for processing
POST/api/v1/job-create
Submit one or more image for processing. Creates one compression job per image. Returns a list of created job IDs.
Request
MIME type
multipart/form-data
Authentication
Basic, API key
Request parameters
Since request is a multipart form, all parameters are passed as individual form parts (see a
curl
example below)options JSON
Request options
options.output_format string
Output format. Valid value: "jpeg"
options.quality integer or array of intergers
Compression quality value(s) to use. Must be in range [30 - 90]. If an integer is provided, it will be used for all images. If an array is provided, its length must be equal to the number of images.
image JPEG or PNG
Image to compress. This parameter can be specified multiple times to submit multiple images as shown in the example below. When building a request, make sure you provide correct MIME types for each image. In the example below,
curl
does this automatically.Request example
curl -u '<YOUR-API-KEY>' -X POST \
-F 'options={ "output_format": "jpeg", "quality": 50 }' \
-F '[email protected]' \
-F '[email protected]' \
https://taucoder.com/api/v1/job-create
-F 'options={ "output_format": "jpeg", "quality": 50 }' \
-F '[email protected]' \
-F '[email protected]' \
https://taucoder.com/api/v1/job-create
Response
MIME type
application/json
Common Response parameters
.request_status
Request status. Possible values: "success", "error"
Successful Response parameters
A successful response returns an array will unique job IDs and statuses for each input image.
Successful response example
{
"request_status": "success",
"jobs": [
{
"job_id": "e4a3ff2f98c82696e7b02fc25",
"status": "in-progress",
"input_filename": "picture1.png"
}, {
"job_id": "5e008c2e172f98c82696e7b02",
"status": "in-progress",
"input_filename": "picture2.jpg"
}
]
}
"request_status": "success",
"jobs": [
{
"job_id": "e4a3ff2f98c82696e7b02fc25",
"status": "in-progress",
"input_filename": "picture1.png"
}, {
"job_id": "5e008c2e172f98c82696e7b02",
"status": "in-progress",
"input_filename": "picture2.jpg"
}
]
}
Error Response parameters
An error response returns a JSON object with HTTP status code and error message.
Error response example
{
"request_status": "error",
"message": "Unauthorized. Did you forget to activate your API key?",
"http_status_code": 401
}
"request_status": "error",
"message": "Unauthorized. Did you forget to activate your API key?",
"http_status_code": 401
}
Retrieve job status and results
POST/api/v1/job-status
Retrieve job status and results for each processed image. Returns a list of jobs with their statuses and presigned AWS download links.
Request
MIME type
application/json
Authentication
Basic, API key
Request parameters
.job_ids array of strings
Array of job identifiers
Request example
curl-u '<YOUR-API-KEY>' -X POST \
-d '{"job_ids": ["e4a3ff2f98c82696e7b02fc25", "5e008c2e172f98c82696e7b02"]}' \
https://taucoder.com/api/v1/job-status
-d '{"job_ids": ["e4a3ff2f98c82696e7b02fc25", "5e008c2e172f98c82696e7b02"]}' \
https://taucoder.com/api/v1/job-status
Response
MIME type
application/json
Common Response parameters
.request_status
Request status. Possible values: "success", "error"
Successful Response parameters
A successful response returns an array will unique job IDs and statuses for each input image. For completed jobs, "output_url" contains a presigned download URL valid for 24 hours.
Successful response example
{
"request_status": "success",
"jobs": [
{
"job_id": "e4a3ff2f98c82696e7b02fc25",
"status": "in-progress",
"input_filename": "picture1.png"
}, {
"job_id": "5e008c2e172f98c82696e7b02",
"status": "done",
"input_filename": "picture2.jpg",
"output_url": "<PRESIGNED-DOWNLOAD-URL>",
"output_content_type": "image/jpeg",
"output_size": 21456
}
]
}
"request_status": "success",
"jobs": [
{
"job_id": "e4a3ff2f98c82696e7b02fc25",
"status": "in-progress",
"input_filename": "picture1.png"
}, {
"job_id": "5e008c2e172f98c82696e7b02",
"status": "done",
"input_filename": "picture2.jpg",
"output_url": "<PRESIGNED-DOWNLOAD-URL>",
"output_content_type": "image/jpeg",
"output_size": 21456
}
]
}
Error Response parameters
An error response returns a JSON object with HTTP status code and error message.
Error response example
{
"request_status": "error",
"message": "Unauthorized. Did you forget to activate your API key?",
"http_status_code": 401
}
"request_status": "error",
"message": "Unauthorized. Did you forget to activate your API key?",
"http_status_code": 401
}