BioPoetry Codon Optimization API

An E. coli codon optimization tool, optimized from high throughput experimental data.

Endpoint: https://biopoetry.com/coapi

You will have received a username and an API key from us. Both go in the request body. Keep the key private, since it identifies your account.

Contents

Quick start

curl -X POST https://biopoetry.com/coapi \
  -H "Content-Type: application/json" \
  -d '{
        "username": "your_username",
        "api_key": "your_api_key",
        "sequence": "MKAVLTGSEDRWQNFPYIHC"
      }'
{
  "protein_sequence": "MKAVLTGSEDRWQNFPYIHC",
  "protein_length": 20,
  "optimized_sequence": "ATGAAGGCAGTTCTGACCGGT...",
  "dna_length": 60,
  "molecular_weight_kda": 2.325,
  "isoelectric_point": 6.81,
  "has_his_tag": false,
  "elapsed_seconds": 1.83
}

Security

All requests must use HTTPS. Plain http:// is refused with a 403 rather than served, so your credentials and sequences are never transmitted in the clear. Transport encryption (TLS 1.2+) protects the request and response end to end.

Two practical consequences:

Request

POST https://biopoetry.com/coapi

JSON body (form-encoded also accepted):

FieldRequiredDescription
usernameyesYour account name.
api_keyyesYour key.
sequenceyesProtein sequence, one-letter codes.

Input is cleaned before validation: whitespace, newlines, hyphens and a trailing * are stripped, and lowercase is accepted. So a sequence pasted straight out of a FASTA body works. Just don't include the > header line.

Limits: 2000 residues per sequence. Only the 20 standard amino acids; X, B, Z, U and other ambiguity codes are rejected.

Start your sequence with methionine (M). The API does not enforce this. We deliberately accept sequences without it, so you can optimize a fragment, a domain, or a region you intend to fuse into a larger construct. But a gene meant to be expressed on its own needs a start codon, and we encode exactly the residues you send: no M in, no ATG out. If your construct is meant to be translated as-is and it doesn't begin with M, that is almost certainly a mistake in the input rather than something we will fix for you.

Likewise, no stop codon is added. The returned DNA ends with the codon for your final residue. Append TAA (or your vector's preferred stop) yourself if the construct needs one.

If you prefer, credentials can go in X-Username and X-API-Key headers instead of the body. Sending both is fine as long as they agree.

Response fields

FieldMeaning
optimized_sequenceThe codon-optimized DNA, 5'→3', no stop codon added.
dna_lengthAlways exactly 3 × protein_length.
molecular_weight_kdaOf the protein, not the DNA.
isoelectric_pointComputed from the protein sequence.
has_his_tagWhether six consecutive histidines are present.
elapsed_secondsServer-side compute time.

Results are not deterministic

The same protein submitted twice returns two different DNA sequences of comparable quality. This is expected. If you need a specific sequence again, save it rather than re-requesting it.

Errors

StatusMeaning
400Bad input: empty sequence, unsupported residue, over the length limit.
401Unknown key, revoked key, or username that doesn't match the key.
403You used plain HTTP. Switch to https://.
500Optimization failed server-side. Retry; if it persists, contact us.

All errors return {"error": "description"}.

Calling from browser JavaScript

The API sends CORS headers, so you can call it from a web page on any domain:

const res = await fetch("https://biopoetry.com/coapi", {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({
    username: "your_username",
    api_key: "your_api_key",
    sequence: "MKAVLTGSEDRWQNFPYIHC"
  })
});
const data = await res.json();
console.log(data.optimized_sequence);

One caution: anything in browser JavaScript is visible to whoever opens the page, including your API key. That's fine for a tool you use yourself or share inside your group. For a page open to the public, put a small backend of your own in front and keep the key on your server.

Running many sequences

One sequence per request. For a library, loop. Each call takes seconds, so there is no long-running request to time out.

import requests

URL = "https://biopoetry.com/coapi"
CREDS = {"username": "your_username", "api_key": "your_api_key"}

def optimize(sequence, session=requests.Session()):
    r = session.post(URL, json={**CREDS, "sequence": sequence}, timeout=120)
    r.raise_for_status()
    return r.json()

for seq in open("proteins.txt"):
    seq = seq.strip()
    if seq:
        print(seq[:15], optimize(seq)["optimized_sequence"])

Reusing one Session keeps the TLS connection alive between calls, which is noticeably faster than a fresh connection per sequence.

Be moderate with parallelism. Two to four concurrent requests is plenty; more will queue rather than go faster, and sustained heavy load may get your key throttled. Write results to disk as they arrive so an interrupted run can resume.

We also ship client_batch.py, which does all of this. CSV in, CSV out, resumable after an interruption, with retries on transient failures:

pip install requests
python client_batch.py proteins.csv results.csv \
    --username your_username --api-key your_api_key

Checking your usage

curl -X POST https://biopoetry.com/coapi/usage \
  -H "Content-Type: application/json" \
  -d '{"username": "your_username", "api_key": "your_api_key"}'
{"username": "your_username", "calls": 412, "last_call_utc": "2026-03-14 09:21:44"}

GET https://biopoetry.com/coapi/health needs no credentials and confirms the service is up.

Terms of use

By using this service you accept the following. If you do not accept them, do not use the service.

Your responsibility. You are solely responsible for every sequence you submit and for every sequence returned to you, including how it is used, ordered, synthesised, expressed, published or distributed. Output is generated automatically and is not reviewed by a person. Verify it independently before committing it to synthesis or any other downstream use.

No warranty. The service is provided on an "as is" and "as available" basis, without warranty of any kind, express or implied, including any warranty of merchantability, fitness for a particular purpose, accuracy, or non-infringement. Liberum does not warrant that output will be correct, optimal, expressible, or suitable for your application.

No liability. Liberum accepts no responsibility or liability for any loss, damage, cost, claim or consequence arising from use of this service or its output, including errors or inaccurate output, failed or suboptimal expression, wasted synthesis or reagent cost, loss of data, interruption of service, or any experimental, commercial, clinical or regulatory outcome. This applies to direct, indirect, incidental, special and consequential damages.

Indemnity. You agree to indemnify, defend and hold harmless Liberum, its officers, employees and agents against any claim, demand, liability, damage, cost or expense, including legal fees, arising from your use of this service, your submitted sequences, or your use of the output.

Permitted use. You must not use this service in connection with any sequence, construct or organism that constitutes a biosecurity, biosafety or public health threat. This includes select agents, agents of concern, toxins, controlled pathogens, and any sequence intended to cause harm to humans, animals, plants or the environment. You must not use the service for any purpose prohibited by applicable law, regulation, export control or sanctions regime, and you are responsible for compliance with the rules of your own jurisdiction and institution.

Field of use. Sequences obtained from this service are for use with Liberum kits and systems. You may not use them with competing cell-free expression kits, systems or services from other suppliers. You may not resell the sequences, or provide sequence optimization to others as a service, using output from this service. Subject to those restrictions, what you do with a construct afterwards is your own affair: there is no restriction on expressing it in cells or organisms, on publishing it, or on continuing to use it in your own work.

No reverse engineering. You must not reverse engineer, decompile, disassemble, probe or otherwise attempt to derive, reconstruct or infer the algorithms, models, parameters, codon tables, scoring functions or other methods underlying this service. This includes systematic or automated submission of sequences designed to map or characterise its behaviour, and benchmarking or comparative analysis carried out for that purpose.

Third-party rights. You are responsible for ensuring that the sequences you submit, and the sequences you receive and use, do not infringe any patent, copyright, trade secret, licence, material transfer agreement or other third-party right. Liberum performs no freedom-to-operate, patent or licensing check of any kind, and makes no representation that output is free of third-party rights.

Suspension. Access may be suspended or revoked at any time, without notice, where use appears to breach these terms.

Support

Contact us if you hit an error, a sequence that fails repeatedly, or a key that stops working. Include the sequence and roughly when you submitted it, and we can look into it.