# Find or create a sync state record for a foreign storage provider.

> For the complete documentation index, see [llms.txt](https://bsvblockchain.com/docs/llms.txt).

**POST** `/sync/state`

Base URL: `https://{host}/storage/v1`

Find or create a sync state record for a foreign storage provider.

## Body

Content type: `application/json`

- `storageIdentityKey` (string, required)
- `storageName` (string, required)

Example:

```json
{
  "storageIdentityKey": "string",
  "storageName": "string"
}
```

## Responses

### 200

Sync state and isNew flag.

- `syncState` (object, required)
  - `created_at` (string<date-time>, required)
  - `updated_at` (string<date-time>, required)
- `isNew` (boolean, required)

Example:

```json
{
  "syncState": {
    "created_at": "1970-01-01T00:00:00.000Z",
    "updated_at": "1970-01-01T00:00:00.000Z"
  },
  "isNew": true
}
```

### 401

Authentication required or token invalid.

- `error` (string, required)
- `code` (string)
  Machine-readable error code (see specs/errors.md).

Example:

```json
{
  "error": "string",
  "code": "string"
}
```