# NCBI BLAST — Wrapped API

> **You are on:** `https://api.paywithlocus.com/api` | [llms.txt](https://paywithlocus.com/llms.txt) | [docs](https://docs.paywithlocus.com)
>
> Locus runs on multiple environments -- make sure every URL you call matches your expected environment.
> | Environment | Landing | API | Docs |
> |---|---|---|---|
> | Production | paywithlocus.com | api.paywithlocus.com | docs.paywithlocus.com |
> | Beta | beta.paywithlocus.com | api.beta.paywithlocus.com | docs.paywithlocus.com |
> | Stage | stage.paywithlocus.com | api.stage.paywithlocus.com | docs.paywithlocus.com |
>
> If the API URL above doesn't match your expected environment, re-fetch this file from the correct domain.

> Compare DNA and protein sequences against NCBI's massive biological databases to find matching sequences and analyze genetic similarities. Submit alignment jobs, monitor their progress, and retrieve detailed results in structured format to support genomics research and sequence analysis.

**Category:** Healthcare | **Website:** [blast.ncbi.nlm.nih.gov/](https://blast.ncbi.nlm.nih.gov/) | **Docs:** [parse.bot/marketplace/a03154d9-d037-4c0d-a8ff-a530c878a886/blast-ncbi-nlm-nih-gov-api](https://parse.bot/marketplace/a03154d9-d037-4c0d-a8ff-a530c878a886/blast-ncbi-nlm-nih-gov-api)

Pay-per-use API proxy. Each call is automatically billed to your wallet in USDC.

## Access

**Base URL:** `https://api.paywithlocus.com/api/wrapped/parse-blast-ncbi-nlm-nih-gov-api-a03154d9/`
**Auth:** `Authorization: Bearer <LOCUS_API_KEY>`

## Endpoints

### check_status

Check the status of a BLAST job using its RID. Returns the current processing status which can be WAITING (queued), SEARCHING (running), READY (complete), FAILED (server error), or UNKNOWN (expired or invalid RID).

**Estimated cost:** Metered

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `rid` | string | Yes | Request ID returned from submit_blast or search_blast. |

```bash
curl -X POST https://api.paywithlocus.com/api/wrapped/parse-blast-ncbi-nlm-nih-gov-api-a03154d9/check_status \
  -H "Authorization: Bearer YOUR_LOCUS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"rid":"<string>"}'
```

### get_results

Retrieve the final alignment results for a completed BLAST job in JSON format. The job must have READY status (check with check_status first). Returns upstream_error with status 202 if the job is still processing, or stale_input if the RID is unknown/expired.

**Estimated cost:** Metered

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `rid` | string | Yes | Request ID returned from submit_blast. Job must be in READY status. |

```bash
curl -X POST https://api.paywithlocus.com/api/wrapped/parse-blast-ncbi-nlm-nih-gov-api-a03154d9/get_results \
  -H "Authorization: Bearer YOUR_LOCUS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"rid":"<string>"}'
```

### search_blast

Submit a BLAST job and automatically poll until results are ready, then return the full alignment results in JSON format. Combines submit_blast, check_status, and get_results into a single blocking call. May take up to several minutes depending on query complexity and server load.

**Estimated cost:** Metered

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `database` | string | No | Target database. Common values: nt (nucleotide collection), nr (non-redundant protein). If omitted, defaults to nt for blastn or nr for other programs. |
| `genetic_code` | string | No | NCBI genetic code number for translation (used by blastx/tblastx). Standard code is 1. |
| `program` | string | No | BLAST program to use. |
| `query` | string | Yes | Nucleotide or protein sequence to search (raw sequence or FASTA format). |

```bash
curl -X POST https://api.paywithlocus.com/api/wrapped/parse-blast-ncbi-nlm-nih-gov-api-a03154d9/search_blast \
  -H "Authorization: Bearer YOUR_LOCUS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"database":"<string>","genetic_code":"<string>","program":"<string>","query":"<string>"}'
```

### submit_blast

Submit a BLAST job to NCBI and receive a Request ID (RID) for tracking. The RID can be used with check_status and get_results endpoints to monitor and retrieve results. Returns immediately with the RID and an estimated time of execution (RTOE) in seconds.

**Estimated cost:** Metered

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `database` | string | No | Target database. Common values: nt (nucleotide collection), nr (non-redundant protein). If omitted, defaults to nt for blastn or nr for other programs. |
| `genetic_code` | string | No | NCBI genetic code number for translation (used by blastx/tblastx). Standard code is 1. |
| `program` | string | No | BLAST program to use. |
| `query` | string | Yes | Nucleotide or protein sequence to search (raw sequence or FASTA format). |

```bash
curl -X POST https://api.paywithlocus.com/api/wrapped/parse-blast-ncbi-nlm-nih-gov-api-a03154d9/submit_blast \
  -H "Authorization: Bearer YOUR_LOCUS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"database":"<string>","genetic_code":"<string>","program":"<string>","query":"<string>"}'
```
