ESC
Type to search across all documentation
GET

/formats

Returns all supported input and output format combinations. Use this endpoint to validate a conversion before submitting a file.

Required scope: convertacoal:read

Response 200 OK

{
  "success": true,
  "data": {
    "input_formats": ["csv", "xls", "xlsx", "html", "json"],
    "output_formats": ["csv", "xlsx", "html", "pdf", "json"],
    "conversions": [
      { "from": "csv",  "to": ["xlsx", "html", "pdf", "json"] },
      { "from": "xls",  "to": ["csv", "xlsx", "html", "pdf", "json"] },
      { "from": "xlsx", "to": ["csv", "html", "pdf", "json"] },
      { "from": "html", "to": ["csv", "xlsx", "pdf", "json"] },
      { "from": "json", "to": ["csv", "xlsx", "html", "pdf"] }
    ]
  }
}

Format Conversion Matrix

Each row is an input format. Columns show which output formats are supported. A same-format conversion (e.g. csv → csv) is not meaningful and is not supported.

Input \ Output csv xlsx html pdf json
csv
xls
xlsx
html
json
Supported Not applicable (same format)

Example Request

curl https://coals.ai/api/v1/convertacoal/formats \
  -H "Authorization: Bearer YOUR_API_KEY"
// Using Guzzle
$response = $client->get('https://coals.ai/api/v1/convertacoal/formats', [
  'headers' => ['Authorization' => 'Bearer YOUR_API_KEY']
]);
$data = json_decode($response->getBody(), true);
# Using requests
import requests

response = requests.get(
  "https://coals.ai/api/v1/convertacoal/formats",
  headers={"Authorization": "Bearer YOUR_API_KEY"}
)
data = response.json()
# Using net/http
require "net/http"
require "json"

uri = URI("https://coals.ai/api/v1/convertacoal/formats")
req = Net::HTTP::Get.new(uri)
req["Authorization"] = "Bearer YOUR_API_KEY"

res = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) { |http| http.request(req) }
data = JSON.parse(res.body)
// Using fetch (Node 18+)
const response = await fetch("https://coals.ai/api/v1/convertacoal/formats", {
  method: "GET",
  headers: {
    "Authorization": "Bearer YOUR_API_KEY"
  }
});
const data = await response.json();