curl --request POST \
--url https://api.example.com/v1/codon-exports/batches \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"host": "cho",
"items": [
{
"signal_peptides": {
"H": "aaaabbbb-cccc-dddd-eeee-ffffaaaabbbb"
},
"variant_id": "11112222-3333-4444-5555-666677778888"
}
],
"output_formats": [
"fasta",
"csv"
],
"strategy": "cai_max"
}
'import requests
url = "https://api.example.com/v1/codon-exports/batches"
payload = {
"host": "cho",
"items": [
{
"signal_peptides": { "H": "aaaabbbb-cccc-dddd-eeee-ffffaaaabbbb" },
"variant_id": "11112222-3333-4444-5555-666677778888"
}
],
"output_formats": ["fasta", "csv"],
"strategy": "cai_max"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
host: 'cho',
items: [
{
signal_peptides: {H: 'aaaabbbb-cccc-dddd-eeee-ffffaaaabbbb'},
variant_id: '11112222-3333-4444-5555-666677778888'
}
],
output_formats: ['fasta', 'csv'],
strategy: 'cai_max'
})
};
fetch('https://api.example.com/v1/codon-exports/batches', 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.example.com/v1/codon-exports/batches",
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([
'host' => 'cho',
'items' => [
[
'signal_peptides' => [
'H' => 'aaaabbbb-cccc-dddd-eeee-ffffaaaabbbb'
],
'variant_id' => '11112222-3333-4444-5555-666677778888'
]
],
'output_formats' => [
'fasta',
'csv'
],
'strategy' => 'cai_max'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/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.example.com/v1/codon-exports/batches"
payload := strings.NewReader("{\n \"host\": \"cho\",\n \"items\": [\n {\n \"signal_peptides\": {\n \"H\": \"aaaabbbb-cccc-dddd-eeee-ffffaaaabbbb\"\n },\n \"variant_id\": \"11112222-3333-4444-5555-666677778888\"\n }\n ],\n \"output_formats\": [\n \"fasta\",\n \"csv\"\n ],\n \"strategy\": \"cai_max\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/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.example.com/v1/codon-exports/batches")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"host\": \"cho\",\n \"items\": [\n {\n \"signal_peptides\": {\n \"H\": \"aaaabbbb-cccc-dddd-eeee-ffffaaaabbbb\"\n },\n \"variant_id\": \"11112222-3333-4444-5555-666677778888\"\n }\n ],\n \"output_formats\": [\n \"fasta\",\n \"csv\"\n ],\n \"strategy\": \"cai_max\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/v1/codon-exports/batches")
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/json'
request.body = "{\n \"host\": \"cho\",\n \"items\": [\n {\n \"signal_peptides\": {\n \"H\": \"aaaabbbb-cccc-dddd-eeee-ffffaaaabbbb\"\n },\n \"variant_id\": \"11112222-3333-4444-5555-666677778888\"\n }\n ],\n \"output_formats\": [\n \"fasta\",\n \"csv\"\n ],\n \"strategy\": \"cai_max\"\n}"
response = http.request(request)
puts response.read_body{
"batch_id": "<string>",
"job_ids": [
"<string>"
],
"export_ids": [
"<string>"
],
"object": "codon_export_batch"
}{
"code": "insufficient_credits",
"credit_balance": 0,
"credit_cost": 1,
"detail": "Humanization costs 1 credit; balance is 0.",
"instance": "/v1/jobs",
"request_id": "req_01JBX6Y6ZK6N8Q7YJ0F5VX2C3D",
"status": 402,
"title": "Insufficient credits",
"type": "https://docs.kallima.bio/errors/insufficient_credits"
}{
"code": "insufficient_credits",
"credit_balance": 0,
"credit_cost": 1,
"detail": "Humanization costs 1 credit; balance is 0.",
"instance": "/v1/jobs",
"request_id": "req_01JBX6Y6ZK6N8Q7YJ0F5VX2C3D",
"status": 402,
"title": "Insufficient credits",
"type": "https://docs.kallima.bio/errors/insufficient_credits"
}{
"code": "insufficient_credits",
"credit_balance": 0,
"credit_cost": 1,
"detail": "Humanization costs 1 credit; balance is 0.",
"instance": "/v1/jobs",
"request_id": "req_01JBX6Y6ZK6N8Q7YJ0F5VX2C3D",
"status": 402,
"title": "Insufficient credits",
"type": "https://docs.kallima.bio/errors/insufficient_credits"
}{
"code": "insufficient_credits",
"credit_balance": 0,
"credit_cost": 1,
"detail": "Humanization costs 1 credit; balance is 0.",
"instance": "/v1/jobs",
"request_id": "req_01JBX6Y6ZK6N8Q7YJ0F5VX2C3D",
"status": 402,
"title": "Insufficient credits",
"type": "https://docs.kallima.bio/errors/insufficient_credits"
}{
"code": "insufficient_credits",
"credit_balance": 0,
"credit_cost": 1,
"detail": "Humanization costs 1 credit; balance is 0.",
"instance": "/v1/jobs",
"request_id": "req_01JBX6Y6ZK6N8Q7YJ0F5VX2C3D",
"status": 402,
"title": "Insufficient credits",
"type": "https://docs.kallima.bio/errors/insufficient_credits"
}{
"code": "insufficient_credits",
"credit_balance": 0,
"credit_cost": 1,
"detail": "Humanization costs 1 credit; balance is 0.",
"instance": "/v1/jobs",
"request_id": "req_01JBX6Y6ZK6N8Q7YJ0F5VX2C3D",
"status": 402,
"title": "Insufficient credits",
"type": "https://docs.kallima.bio/errors/insufficient_credits"
}Submit a codon export batch
Submit one codon export job per variant in the batch.
Returns 202 Accepted immediately. Poll GET /v1/codon-exports/{id}
until variable_cds is populated.
Ownership: every variant_id in items must belong to the caller’s
org; the first cross-org id returns 404 before any rows are inserted.
Plan gate. Requires Structure plan or above; free-plan callers
receive 402.
Credits. Each variant costs 1 codon-optimization credit. The total
is debited atomically — if any variant would exceed the balance the
whole batch is rejected with 402.
Idempotency. Send a unique Idempotency-Key per submission;
replays return the cached 202 without enqueuing a second batch.
Cost: write — burns rate + quota, and debits credits.
curl --request POST \
--url https://api.example.com/v1/codon-exports/batches \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"host": "cho",
"items": [
{
"signal_peptides": {
"H": "aaaabbbb-cccc-dddd-eeee-ffffaaaabbbb"
},
"variant_id": "11112222-3333-4444-5555-666677778888"
}
],
"output_formats": [
"fasta",
"csv"
],
"strategy": "cai_max"
}
'import requests
url = "https://api.example.com/v1/codon-exports/batches"
payload = {
"host": "cho",
"items": [
{
"signal_peptides": { "H": "aaaabbbb-cccc-dddd-eeee-ffffaaaabbbb" },
"variant_id": "11112222-3333-4444-5555-666677778888"
}
],
"output_formats": ["fasta", "csv"],
"strategy": "cai_max"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
host: 'cho',
items: [
{
signal_peptides: {H: 'aaaabbbb-cccc-dddd-eeee-ffffaaaabbbb'},
variant_id: '11112222-3333-4444-5555-666677778888'
}
],
output_formats: ['fasta', 'csv'],
strategy: 'cai_max'
})
};
fetch('https://api.example.com/v1/codon-exports/batches', 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.example.com/v1/codon-exports/batches",
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([
'host' => 'cho',
'items' => [
[
'signal_peptides' => [
'H' => 'aaaabbbb-cccc-dddd-eeee-ffffaaaabbbb'
],
'variant_id' => '11112222-3333-4444-5555-666677778888'
]
],
'output_formats' => [
'fasta',
'csv'
],
'strategy' => 'cai_max'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/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.example.com/v1/codon-exports/batches"
payload := strings.NewReader("{\n \"host\": \"cho\",\n \"items\": [\n {\n \"signal_peptides\": {\n \"H\": \"aaaabbbb-cccc-dddd-eeee-ffffaaaabbbb\"\n },\n \"variant_id\": \"11112222-3333-4444-5555-666677778888\"\n }\n ],\n \"output_formats\": [\n \"fasta\",\n \"csv\"\n ],\n \"strategy\": \"cai_max\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/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.example.com/v1/codon-exports/batches")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"host\": \"cho\",\n \"items\": [\n {\n \"signal_peptides\": {\n \"H\": \"aaaabbbb-cccc-dddd-eeee-ffffaaaabbbb\"\n },\n \"variant_id\": \"11112222-3333-4444-5555-666677778888\"\n }\n ],\n \"output_formats\": [\n \"fasta\",\n \"csv\"\n ],\n \"strategy\": \"cai_max\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/v1/codon-exports/batches")
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/json'
request.body = "{\n \"host\": \"cho\",\n \"items\": [\n {\n \"signal_peptides\": {\n \"H\": \"aaaabbbb-cccc-dddd-eeee-ffffaaaabbbb\"\n },\n \"variant_id\": \"11112222-3333-4444-5555-666677778888\"\n }\n ],\n \"output_formats\": [\n \"fasta\",\n \"csv\"\n ],\n \"strategy\": \"cai_max\"\n}"
response = http.request(request)
puts response.read_body{
"batch_id": "<string>",
"job_ids": [
"<string>"
],
"export_ids": [
"<string>"
],
"object": "codon_export_batch"
}{
"code": "insufficient_credits",
"credit_balance": 0,
"credit_cost": 1,
"detail": "Humanization costs 1 credit; balance is 0.",
"instance": "/v1/jobs",
"request_id": "req_01JBX6Y6ZK6N8Q7YJ0F5VX2C3D",
"status": 402,
"title": "Insufficient credits",
"type": "https://docs.kallima.bio/errors/insufficient_credits"
}{
"code": "insufficient_credits",
"credit_balance": 0,
"credit_cost": 1,
"detail": "Humanization costs 1 credit; balance is 0.",
"instance": "/v1/jobs",
"request_id": "req_01JBX6Y6ZK6N8Q7YJ0F5VX2C3D",
"status": 402,
"title": "Insufficient credits",
"type": "https://docs.kallima.bio/errors/insufficient_credits"
}{
"code": "insufficient_credits",
"credit_balance": 0,
"credit_cost": 1,
"detail": "Humanization costs 1 credit; balance is 0.",
"instance": "/v1/jobs",
"request_id": "req_01JBX6Y6ZK6N8Q7YJ0F5VX2C3D",
"status": 402,
"title": "Insufficient credits",
"type": "https://docs.kallima.bio/errors/insufficient_credits"
}{
"code": "insufficient_credits",
"credit_balance": 0,
"credit_cost": 1,
"detail": "Humanization costs 1 credit; balance is 0.",
"instance": "/v1/jobs",
"request_id": "req_01JBX6Y6ZK6N8Q7YJ0F5VX2C3D",
"status": 402,
"title": "Insufficient credits",
"type": "https://docs.kallima.bio/errors/insufficient_credits"
}{
"code": "insufficient_credits",
"credit_balance": 0,
"credit_cost": 1,
"detail": "Humanization costs 1 credit; balance is 0.",
"instance": "/v1/jobs",
"request_id": "req_01JBX6Y6ZK6N8Q7YJ0F5VX2C3D",
"status": 402,
"title": "Insufficient credits",
"type": "https://docs.kallima.bio/errors/insufficient_credits"
}{
"code": "insufficient_credits",
"credit_balance": 0,
"credit_cost": 1,
"detail": "Humanization costs 1 credit; balance is 0.",
"instance": "/v1/jobs",
"request_id": "req_01JBX6Y6ZK6N8Q7YJ0F5VX2C3D",
"status": 402,
"title": "Insufficient credits",
"type": "https://docs.kallima.bio/errors/insufficient_credits"
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Body
Body for POST /v1/codon-exports/batches.
Codon optimization strategy. See GET /v1/codon-exports/strategies for the list of registered strategy names.
"cai_max"
Target expression host. Drives codon table selection.
cho, hek293, ecoli, pichia "cho"
Formats to make available for download (fasta, csv, genbank).
1fasta, genbank, csv ["fasta", "csv"]
One entry per variant to export.
1Show child attributes
Show child attributes
Strategy-specific options (see option_schema in the strategy catalogue).
Response
Successful Response
Response from POST /v1/codon-exports/batches.
Opaque batch identifier (UUID).
One job UUID per submitted variant.
One export UUID per submitted variant.
Polymorphic discriminator. Always codon_export_batch.
"codon_export_batch"