# zone.stratos.repo.importRepo

> Published by [lexicon.northsky.app](https://lexicon.garden/identity/did:plc:6uxgo3ypovauub7nblwylqyv)

✓ This is the authoritative definition for this NSID.

## Links

- [View on Lexicon Garden](https://lexicon.garden/lexicon/did:plc:6uxgo3ypovauub7nblwylqyv/zone.stratos.repo.importRepo)
- [Documentation](https://lexicon.garden/lexicon/did:plc:6uxgo3ypovauub7nblwylqyv/zone.stratos.repo.importRepo/docs)
- [Examples](https://lexicon.garden/lexicon/did:plc:6uxgo3ypovauub7nblwylqyv/zone.stratos.repo.importRepo/examples)

## Definitions

### `zone.stratos.repo.importRepo`

**Type**: `procedure`

Import a repository from a CAR file. Verifies record CID integrity and re-signs with the destination service key. The caller must be enrolled as the DID in the CAR's commit block.

#### Input

**Encoding**: `application/vnd.ipld.car`

#### Output

**Encoding**: `application/json`

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `imported` | `integer` | Yes | Number of records successfully imported. |

#### Errors

- **InvalidCar**: The CAR file is malformed, has missing blocks, or contains records with mismatched CIDs.
- **RepoAlreadyExists**: The destination already has records for this DID. Import is only supported for empty repos.

## Raw Schema

```json
{
  "id": "zone.stratos.repo.importRepo",
  "defs": {
    "main": {
      "type": "procedure",
      "input": {
        "encoding": "application/vnd.ipld.car"
      },
      "errors": [
        {
          "name": "InvalidCar",
          "description": "The CAR file is malformed, has missing blocks, or contains records with mismatched CIDs."
        },
        {
          "name": "RepoAlreadyExists",
          "description": "The destination already has records for this DID. Import is only supported for empty repos."
        }
      ],
      "output": {
        "schema": {
          "type": "object",
          "required": [
            "imported"
          ],
          "properties": {
            "imported": {
              "type": "integer",
              "description": "Number of records successfully imported."
            }
          }
        },
        "encoding": "application/json"
      },
      "description": "Import a repository from a CAR file. Verifies record CID integrity and re-signs with the destination service key. The caller must be enrolled as the DID in the CAR's commit block."
    }
  },
  "$type": "com.atproto.lexicon.schema",
  "lexicon": 1
}
```
