# Quickstart: REST

Fold Trp-cage with ESMFold and download the structure.

## 1. Authenticate

```
export PHI_API=https://phi.dynotx.com
export PHI_KEY=ak_your_key
curl -s "$PHI_API/v1/quota" -H "x-api-key: $PHI_KEY"
```

An organization API key (ak_…) from design.dynotx.com → your account → API keys. Personal keys are refused, since Phi has to know which workspace to bill.

## 2. Submit

```
JOB_ID=$(curl -s -X POST "$PHI_API/v1/jobs" \
  -H "x-api-key: $PHI_KEY" -H "content-type: application/json" \
  -d '{ "job_type": "ESMFOLD", "name": "quickstart-trp-cage",
        "inputs": { "sequences": ["NLYIQWLKDGGPSSGRPPPS"] } }' | jq -r .job_id)
echo $JOB_ID
```

The response carries the job id and a status_url before anything runs.

## 3. Wait

```
until [ "$(curl -s "$PHI_API/v1/jobs/$JOB_ID" -H "x-api-key: $PHI_KEY" | jq -r .status)" = "COMPLETED" ]; do sleep 15; done
```

Statuses: PENDING, RUNNING, COMPLETED, FAILED, CANCELLED, ERROR.

## 4. Download the structure

```
URL=$(curl -s "$PHI_API/v1/runs/$JOB_ID/artifacts?suffix=.pdb" -H "x-api-key: $PHI_KEY" | jq -r '.[0].url')
curl -sL "$URL" -o quickstart-trp-cage.pdb
```

Artifacts come back as signed HTTPS URLs that expire after an hour.

---
Source: https://phi.dynotx.com/docs/quickstart/rest
