---
title: "Create codon-optimized DNA sequences."
method: POST
path: "/dna-sequences:optimize-codons"
tags: ["dnaSequences"]
---

# Create codon-optimized DNA sequences.

`POST /dna-sequences:optimize-codons`

## Request

- Base URL: `https://{tenant_name}.benchling.com/api/v2`
- URL: `https://{tenant_name}.benchling.com/api/v2/dna-sequences:optimize-codons`
- Auth: HTTP bearer

Create codon-optimized DNA sequences.

## Request body

- OptimizeCodons
  - `avoidedCutsiteEnzymeIds` string[]: List of enzyme IDs whose recognition sites will be avoided when creating the optimized sequence.
  - `codonUsageTableId` string: ID of the codon usage table representing the target organism.
  - `dnaSequenceIds` string[], required: IDs of DNA sequences to codon-optimize.
  - `folderId` string, required: ID of the folder in which the optimized sequences will be saved.
  - `gcContent` 'ANY' | 'LOW' | 'MEDIUM' | 'HIGH': The amount of GC content in the optimized sequence. LOW is defined as below 0.33, MEDIUM as 0.33-0.66, and HIGH as above 0.66. If neither gcContent nor gcContentRange is specified, the optimization will default to ANY (0-1). Cannot be specified together with gcContentRange.
  - `gcContentRange` OptimizeCodonsGcContentRange: Custom GC content range for the optimized sequence, specified as decimal values between 0 and 1. The maximum must be greater than the minimum. Cannot be specified together with gcContent.
    - `max` number, double: Maximum GC content ratio (e.g., 0.6 for 60%)
    - `min` number, double: Minimum GC content ratio (e.g., 0.4 for 40%)
  - `hairpinParameters` OptimizeCodonsHairpinParameters: These parameters are applied in the AvoidHairpins specification in DNAChisel. If hairpinParameters is not specified, hairpins will not be avoided.
    - `stem` integer
    - `window` integer
  - `method` 'MATCH_CODON_USAGE' | 'USE_BEST_CODON': The codon optimization algorithm to use. Requires codonUsageTableId to be specified. MATCH_CODON_USAGE selects codons probabilistically based on the organism's codon usage frequencies. USE_BEST_CODON always selects the most frequently used codon for each amino acid.
  - `reducedPatterns` ReducedPattern[]: List of patterns to avoid when creating the optimized sequence, on the coding strand only.
    - `avoidReverseComplement` boolean
    - `pattern` string
  - `schemaId` string: ID of the optimized DNA sequences' schemas
  - `shouldDepleteUridine` boolean: If not specified, the optimization will default to false, and mRNA uridine depletion will not be performed.

## Response `202`

This endpoint launches a [long-running task](https://docs.benchling.com/docs/api/v2/benchling-api/tasks/get-task) and returns the Task ID of the launched task.
When successful, the task has an empty response.

- AsyncTaskLink
  - `taskId` string

## Other responses

- `400`: Bad Request

---

[API](https://skmtc.dev/benchling/apis/benchling-api-2.md) - [All operations](https://skmtc.dev/benchling/apis/benchling-api-2/llms.txt) - [OpenAPI document](https://skmtc.dev/benchling/apis/benchling-api-2/revisions/01d2fa8523cd?raw)
