# Resolve and pin dependencies

```http
POST /projects/{project_reference}/dependencies/resolve
```

Resolve dependency pins. Requires project.files.write.

## Parameters

| Name                | In   | Required | Description |
| ------------------- | ---- | -------- | ----------- |
| `project_reference` | path | Yes      |             |

## Request body

| Field                   | Type   | Required | Description                                                                                                                                                                                                                                                                                                                                                                                                             |
| ----------------------- | ------ | -------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `specifiers`            | array  | Yes      | npm package specifiers to pin in package.json after adding imports or packages. Inline exact versions are used as-is; ranges and bare names resolve against the npm registry (cached in Redis). Existing exact pins are never overwritten. Each entry may be a bare name, a name with an inline exact version, or a name with a semver range (for example, "react", "got\@12.6.1", "zod@^3", "@radix-ui/react-dialog"). |
| `branch`                | string |          | Branch name or UUID, 1–255 characters without surrounding whitespace. Omit for main; selected package.json receives the resolved pins.                                                                                                                                                                                                                                                                                  |
| `expected_declarations` | object |          | Package declarations observed by the caller, at most 100 entries with string values up to 200 characters. A null value means the package was absent. When supplied, every requested package must be present and stale declarations are not overwritten.                                                                                                                                                                 |

## Responses

| Status | Description                                         |
| ------ | --------------------------------------------------- |
| 200    | Dependency resolution result.                       |
| 400    | Invalid specifier syntax or batch size exceeded     |
| 401    | Unauthorized                                        |
| 403    | Forbidden — project.files.write capability required |
| 404    | Project or branch not found                         |
| 500    | Server error                                        |
