> This page is for OpenFold2, version 2.1.0.
> For other versions, use one of these documentation indexes:
> - 2.6.0 (Latest) (default): https://docs.nvidia.com/nim/bionemo/openfold2/2.6.0/llms.txt
> - 2.5.0: https://docs.nvidia.com/nim/bionemo/openfold2/2.5.0/llms.txt
> - 2.4.0: https://docs.nvidia.com/nim/bionemo/openfold2/2.4.0/llms.txt
> - 2.3.0: https://docs.nvidia.com/nim/bionemo/openfold2/2.3.0/llms.txt
> - 2.2.0: https://docs.nvidia.com/nim/bionemo/openfold2/2.2.0/llms.txt
> - 2.1.0: https://docs.nvidia.com/nim/bionemo/openfold2/2.1.0/llms.txt
> - 2.0.0: https://docs.nvidia.com/nim/bionemo/openfold2/2.0.0/llms.txt
> - 1.2.0: https://docs.nvidia.com/nim/bionemo/openfold2/1.2.0/llms.txt
> - 1.1.0: https://docs.nvidia.com/nim/bionemo/openfold2/1.1.0/llms.txt
> - 1.0.0: https://docs.nvidia.com/nim/bionemo/openfold2/1.0.0/llms.txt

> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.nvidia.com/nim/bionemo/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.nvidia.com/nim/bionemo/_mcp/server.

# Nim Api Post Call Monomer Structure From Msa And Template

POST /biology/openfold/openfold2/predict-structure-from-msa-and-template
Content-Type: application/json

Reference: https://docs.nvidia.com/nim/bionemo/openfold2/api-reference/nim-api-post-call-monomer-structure-from-msa-and-template-biology-openfold-openfold-2-predict-structure-from-msa-and-template-post

## Request

### Body (application/json)

This endpoint expects an OF2MonomerInput.

- `sequence` (string, required) — An input polypeptide (i.e., amino acid) sequence that must be composed of valid Amino Acid IUPAC symbols.
- `input_id` (string, optional, nullable) — Identifier / tag for the input.
- `alignments` (map from string to map from string to AlignmentFileRecord, optional, nullable) — The multiple-sequence-alignment, must be in a3m format.
- `selected_models` (list of integer, optional, nullable, default: [1,2,3,4,5]) — Allows selecting the parameters used for protein structure prediction.
- `relax_prediction` (boolean, optional, nullable, default: false) — Run structural relaxation after prediction
- `use_templates` (boolean, optional, nullable, default: false) — Use the templates, if provided, as features for structure prediction.
- `explicit_templates` (list of StructuralTemplate, optional, nullable) — List of user-supplied structural templates in mmCIF format.

## Response

### 200

Successful Response

- `structures_in_ranked_order` (list of OF2StructureRecord, optional, default: [])
- `input_id` (string, optional, nullable) — Identifier / tag for the input.
- `metrics` (map from string to any, optional, default: {}) — Metrics for the structure prediction.
- `of2_nim_handled_error_message` (string, optional, nullable, default: no-handled-error) — Handled error

## Errors

### 422 Unprocessable Entity Error

Validation Error

- `detail` (list of ValidationError, optional)

## Types

### AlignmentFileRecord

Represents a single alignment. This is just the raw file output read into a string and of a defined version.

- `alignment` (string, required) — The contents of a single MSA.
- `format` (enum, required) — The format of the alignment record(s). This should be a3m.
  - Allowed values: `a3m`

### StructuralTemplate

Represents a single structure prediction. This is just the raw file output read into a string and of a defined version.

- `structure` (StructuralTemplateStructure, required) — The contents of a single structural template.
- `format` (enum, required) — The format of the structure record. Can be uncompressed (mmcif) or gzipped (mmcif.gz).
  - Allowed values: `mmcif`, `mmcif.gz`
- `name` (string, optional, nullable, default: ) — An optional name for the structure.
- `source` (string, optional, nullable, default: ) — The source file for the structure.
- `rank` (integer, optional, nullable, default: -1) — An integer rank to define the ordering of alignments (for example, when concatenating alignments).
- `checksum` (Checksum, optional, nullable) — Optional checksum of the structure data.
- `compression_ratio` (double, optional, nullable) — The compression ratio achieved when the structure was compressed (original size / compressed size).

### OF2StructureRecord

Include rank_by_confidence as self-documenting.

- `structure` (string, required) — The contents of a single MSA.
- `format` (string, required) — The format of the structure, pdb or mmcif.
- `relaxed` (boolean, required) — Was relaxation applied.
- `rank_by_confidence` (integer, required)
- `confidence` (double, required, nullable) — Confidence used to rank.
- `model_param_set` (integer, optional, nullable) — Model parameter set used for this prediction

### ValidationError

- `loc` (list of ValidationErrorLocItems, required)
- `msg` (string, required)
- `type` (string, required)

### StructuralTemplateStructure

The contents of a single structural template.

- string
- string

### Checksum

Represents a checksum of data using a specific algorithm.

- `checksum` (string, required) — The hexadecimal representation of the checksum.
- `algorithm` (enum, optional) — The algorithm used to generate the checksum.
  - Allowed values: `sha256`, `blake3`

### ValidationErrorLocItems

- string
- integer

## Examples

**Request**

```json
{
  "sequence": "string"
}
```

**Response**

```json
{
  "structures_in_ranked_order": [
    {
      "structure": "string",
      "format": "string",
      "relaxed": true,
      "rank_by_confidence": 1,
      "confidence": 1.1,
      "model_param_set": 1
    }
  ],
  "input_id": "7WBN_A",
  "metrics": {
    "relaxation_time_in_seconds": 81.2
  },
  "of2_nim_handled_error_message": "string"
}
```

**SDK Code**

```python
import requests

url = "https://api.example.com/biology/openfold/openfold2/predict-structure-from-msa-and-template"

payload = { "sequence": "string" }
headers = {"Content-Type": "application/json"}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript
const url = 'https://api.example.com/biology/openfold/openfold2/predict-structure-from-msa-and-template';
const options = {
  method: 'POST',
  headers: {'Content-Type': 'application/json'},
  body: '{"sequence":"string"}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.example.com/biology/openfold/openfold2/predict-structure-from-msa-and-template"

	payload := strings.NewReader("{\n  \"sequence\": \"string\"\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby
require 'uri'
require 'net/http'

url = URI("https://api.example.com/biology/openfold/openfold2/predict-structure-from-msa-and-template")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n  \"sequence\": \"string\"\n}"

response = http.request(request)
puts response.read_body
```

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.example.com/biology/openfold/openfold2/predict-structure-from-msa-and-template")
  .header("Content-Type", "application/json")
  .body("{\n  \"sequence\": \"string\"\n}")
  .asString();
```

```php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.example.com/biology/openfold/openfold2/predict-structure-from-msa-and-template', [
  'body' => '{
  "sequence": "string"
}',
  'headers' => [
    'Content-Type' => 'application/json',
  ],
]);

echo $response->getBody();
```

```csharp
using RestSharp;

var client = new RestClient("https://api.example.com/biology/openfold/openfold2/predict-structure-from-msa-and-template");
var request = new RestRequest(Method.POST);
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"sequence\": \"string\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = ["Content-Type": "application/json"]
let parameters = ["sequence": "string"] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.example.com/biology/openfold/openfold2/predict-structure-from-msa-and-template")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```