# List Storage instances

> Media API · Storage

```http
GET https://app.mk.io/api/v1/projects/{project_name}/media/storage
```

## Listing, Sorting and Filtering Storage Instances

This endpoint returns the list of storage instances in the specified project.

### Sorting

The results from this endpoint can be ordered using the `$orderby` query parameter. Specify a list of field names, separated by commas
where each one can optionally specify `asc` or `desc`.

Sorting is valid on the following fields: `created`, `createdBy`, `id`, `name`, `privateLinkServiceConnectionStatus`, `type`, `updated`, `updatedBy`, `url`

### Filtering

The `$filter` query parameter allows for storage instances to be filtered on the basis of fields in the schema using OData query syntax.
See [this document](https://learn.microsoft.com/en-us/odata/concepts/queryoptions-overview#filter) for more details on the syntax used.

Filters are valid on the following fields: `cloud/name`, `cloud/region/name`, `created`, `createdBy`, `createdByEmail`, `createdByName`, `id`, `name`, `privateLinkServiceConnectionStatus`, `region`, `type`, `updated`, `updatedBy`, `updatedByEmail`, `updatedByName`, `url`

### Examples:

`?$top=10` - Returns only the first 10 storage instances from the list.

`?$orderby=name desc` - Sorts storage instances by name in descending order.

`?$filter=name eq 'descriptive name'` - Returns storage instances that match the provided name.

`?$orderby=created desc` - Sorts storage instances by creation date in descending order.

`?$filter=created ge 2021-01-01T00:00:00Z` - Returns storage instances created after January 1, 2021.

RBAC Capability Required: `infra.storage.get`

## Authentication

- `Authorization` header — Bearer authentication of the form `Bearer <token>`.

## Path parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `project_name` | string | Yes | — |

## Query parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `$orderby` | string | No | Specifies the key by which the result collection should be ordered. |
| `$filter` | string | No | Restricts the set of items returned. |
| `$top` | string | No | Specifies a non-negative integer `n` that limits the number of items returned from a collection. The service returns the number of available items up to but not greater than the specified value `n`. |
| `$skiptoken` | string | No | Specifies a start offset to support paginated results. Use `@odata.nextLink` in the result object to enumerate the collection - it will be present only if there's more than one page of entities. |

## Example request

```bash
curl -X GET "https://app.mk.io/api/v1/projects/{project_name}/media/storage" \
  -H "Authorization: Bearer <token>"
```

## Responses

### 200 — A list of Storage instances

- `@odata.nextLink` · string · Optional — @odata.nextLink URL if the page length and number of items match.
- `supplemental` · object · **Required** — Supplemental info
  - `count` · integer · **Required** — Number of items returned
  - `kind` · string · **Required** — Type of items in the list
  - `operation` · string · **Required** — Operation type. Should always say 'list'
  - `pagination` · object · **Required** — Pagination info
    - `end` · integer · **Required** — Position of the last item in the list
    - `records` · integer · **Required** — Total number of items returned in the list
    - `start` · integer · **Required** — Position of the first item in the list
    - `total` · integer · **Required** — Total number of items in the project
  - `subscription` · object · Optional — Project info
    - `id` · string · **Required** — Project ID
    - `name` · string · **Required** — Project name
- `value` · list of objects · **Required** — List of storage instances.
  - Array items (object):
    - `kind` · string · Optional — The kind of record.
    - `metadata` · object · **Required** — Metadata about the storage instance.
      - `created` · string · Optional · _format: date-time_ — The time when the resource was created
      - `createdBy` · string · Optional · _format: uuid_ — ID of the user who created the resource
      - `createdByEmail` · string · Optional — Email of the user who created the resource
      - `id` · string · **Required** · _format: uuid_ — The ID of the resource
      - `name` · string · Optional — The name of the resource
      - `updated` · string · Optional · _format: date-time_ — The time when the resource was last updated
      - `updatedBy` · string · Optional · _format: uuid_ — ID of the user who last updated the resource
      - `updatedByEmail` · string · Optional — Email of the user who last updated the resource
    - `spec` · object · **Required** — The specification of the storage instance.
      - One of the following variants, selected by `type`:
        - **Microsoft.Storage** (object)
          - `credential` · object · Optional — The credential for the Azure Storage Account
            - `sasToken` · string · **Required** · _pattern: ^\?([a-z]+=[^&]+)(&[a-z]+=[^&]+)+$_ — SAS Token for Azure Storage Account, including leading ?
            - `signedExpiry` · string · **Required** · _format: date-time_ — The expiry time of the token.
            - `signedStart` · string or null · **Required** · _format: date-time_ — The start time of the token.
          - `description` · string or null · **Required** — Description of the storage.
          - `privateLinkServiceConnection` · object or null · Optional — Optional settings for a Private Link. Set it to null to remove the Private Link.
            - `requestMessage` · string · **Required** · _0-140 characters_ — A message passed to the owner of the remote resource with this connection request. This field cannot be modified, only set during creation.
            - `resourceGroupName` · string · **Required** · _1-90 characters_ — The name of the resource group containing the storage account This field cannot be modified, only set during creation.
            - `storageAccountName` · string · **Required** · _3-24 characters_ — The name of the storage account. The full Azure ID would be '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{storageAccountName}' This field cannot be modified, only set during creation.
            - `subscriptionId` · string · **Required** · _format: uuid_ — The ID of the Azure subscription containing the storage account This field cannot be modified, only set during creation.
          - `region` · string or null · **Required** — Storage region.
          - `type` · enum · **Required** — The type of storage. This field cannot be modified, only set during creation.
            - Allowed values: `Microsoft.Storage`, `AWS.S3`, `Google.Storage`
          - `url` · string · **Required** — HTTP(S) URL required for access to the storage. This field cannot be modified, only set during creation.
        - **AWS.S3** (object)
          - `bucketName` · string · **Required** · _pattern: ^(?!.*\.\.)[a-z0-9][-a-z0-9.]{1,61}[a-z0-9]$_ — The name of the AWS S3 bucket. This field cannot be modified, only set during creation.
          - `credential` · object · Optional — The credential for the AWS S3 bucket. Required at creation.
            - `accessKeyId` · string · **Required** · _pattern: ^A[KS]IA[0-9A-Z]{16}$_ — The access key ID for the bucket.
            - `secretAccessKey` · string · **Required** · _pattern: ^[A-Za-z0-9+/=]{40}$_ — The secret access key for the bucket.
          - `description` · string or null · **Required** — Description of the storage.
          - `region` · string or null · **Required** — Storage region.
          - `type` · enum · **Required** — The type of storage. This field cannot be modified, only set during creation.
            - Allowed values: `Microsoft.Storage`, `AWS.S3`, `Google.Storage`
          - `url` · string · **Required** — The URL of the S3 bucket
        - **Google.Storage** (object)
          - `bucketName` · string · **Required** · _2-256 characters_ — The name of the Google Storage bucket. This field cannot be modified, only set during creation.
          - `credential` · object · Optional — The credential for the Google Storage bucket. Required at creation.
            - `gac` · map from strings to string · **Required** — Google Application Credentials in JSON format. You can generate this from the command line with `gcloud iam service-accounts keys create key.json --iam-account=<service_account>@<project>.iam.gserviceaccount.com` Or download it from the GCP console.
              - `[any key]` · string — map of additional properties
          - `description` · string or null · **Required** — Description of the storage.
          - `region` · string or null · **Required** — Storage region.
          - `type` · enum · **Required** — The type of storage. This field cannot be modified, only set during creation.
            - Allowed values: `Microsoft.Storage`, `AWS.S3`, `Google.Storage`
    - `status` · object · Optional — Additional status information regarding the storage instance.
      - `activeCredentialId` · string or null · **Required** · _format: uuid_ — The ID of the active credential for this storage.
      - `privateLinkServiceConnectionStatus` · enum · Optional — The state of the Azure Private Connection, if enabled.
        - Allowed values: `Creating`, `Pending`, `Ready`, `Running`, `Deleting`, `Deleted`

Example:

```json
{
  "@odata.nextLink": "string",
  "supplemental": {
    "count": 0,
    "kind": "string",
    "operation": "string",
    "pagination": {
      "end": 0,
      "records": 0,
      "start": 0,
      "total": 0
    },
    "subscription": {
      "id": "string",
      "name": "string"
    }
  },
  "value": [
    {
      "kind": "string",
      "metadata": {
        "created": "2024-01-01T00:00:00Z",
        "createdBy": "00000000-0000-0000-0000-000000000000",
        "createdByEmail": "string",
        "id": "00000000-0000-0000-0000-000000000000",
        "name": "string",
        "updated": "2024-01-01T00:00:00Z",
        "updatedBy": "00000000-0000-0000-0000-000000000000",
        "updatedByEmail": "string"
      },
      "spec": {
        "type": "Microsoft.Storage",
        "credential": {
          "sasToken": "?sv=2022-11-02&ss=bfqt&srt=co&sp=rwdlacupiyx&se=2024-11-12T00:05:04Z&st=2024-11-11T16:05:04Z&spr=https&sig=<redacted>",
          "signedExpiry": "2024-11-12T00:05:04Z",
          "signedStart": "2024-11-11T16:05:04Z"
        },
        "description": "Input media files for processing.",
        "privateLinkServiceConnection": {
          "requestMessage": "string",
          "resourceGroupName": "string",
          "storageAccountName": "string",
          "subscriptionId": "00000000-0000-0000-0000-000000000000"
        },
        "region": "string",
        "url": "https://blobsamples.blob.core.windows.net/"
      },
      "status": {
        "activeCredentialId": "00000000-0000-0000-0000-000000000000",
        "privateLinkServiceConnectionStatus": "Creating"
      }
    }
  ]
}
```

### 400 — Bad Request

- `error` · object · **Required** — Pertinent information about the error
  - `code` · string · **Required** — The error code.
  - `detail` · string · **Required** — The error message.
  - `extraDetail` · map from strings to any · Optional — Extra information regarding this error.
    - `[any key]` · any — map of additional properties
- `ref` · string · **Required** — A reference to the request that caused the error.
- `status` · integer · **Required** — The HTTP status code

Example:

```json
{
  "error": {
    "code": "string",
    "detail": "string",
    "extraDetail": {
      "key": null
    }
  },
  "ref": "string",
  "status": 0
}
```

### 401 — Unauthorized

- `error` · object · **Required** — Pertinent information about the error
  - `code` · string · **Required** — The error code.
  - `detail` · string · **Required** — The error message.
  - `extraDetail` · map from strings to any · Optional — Extra information regarding this error.
    - `[any key]` · any — map of additional properties
- `ref` · string · **Required** — A reference to the request that caused the error.
- `status` · integer · **Required** — The HTTP status code

Example:

```json
{
  "error": {
    "code": "string",
    "detail": "string",
    "extraDetail": {
      "key": null
    }
  },
  "ref": "string",
  "status": 0
}
```

### 403 — Forbidden

- `error` · object · **Required** — Pertinent information about the error
  - `code` · string · **Required** — The error code.
  - `detail` · string · **Required** — The error message.
  - `extraDetail` · map from strings to any · Optional — Extra information regarding this error.
    - `[any key]` · any — map of additional properties
- `ref` · string · **Required** — A reference to the request that caused the error.
- `status` · integer · **Required** — The HTTP status code

Example:

```json
{
  "error": {
    "code": "string",
    "detail": "string",
    "extraDetail": {
      "key": null
    }
  },
  "ref": "string",
  "status": 0
}
```

### 404 — Not Found

- `error` · object · **Required** — Pertinent information about the error
  - `code` · string · **Required** — The error code.
  - `detail` · string · **Required** — The error message.
  - `extraDetail` · map from strings to any · Optional — Extra information regarding this error.
    - `[any key]` · any — map of additional properties
- `ref` · string · **Required** — A reference to the request that caused the error.
- `status` · integer · **Required** — The HTTP status code

Example:

```json
{
  "error": {
    "code": "string",
    "detail": "string",
    "extraDetail": {
      "key": null
    }
  },
  "ref": "string",
  "status": 0
}
```

### 429 — Too Many Requests

- `error` · object · **Required** — Pertinent information about the error
  - `code` · string · **Required** — The error code.
  - `detail` · string · **Required** — The error message.
  - `extraDetail` · map from strings to any · Optional — Extra information regarding this error.
    - `[any key]` · any — map of additional properties
- `ref` · string · **Required** — A reference to the request that caused the error.
- `status` · integer · **Required** — The HTTP status code

Example:

```json
{
  "error": {
    "code": "string",
    "detail": "string",
    "extraDetail": {
      "key": null
    }
  },
  "ref": "string",
  "status": 0
}
```

### 500 — Internal Server Error

- `error` · object · **Required** — Pertinent information about the error
  - `code` · string · **Required** — The error code.
  - `detail` · string · **Required** — The error message.
  - `extraDetail` · map from strings to any · Optional — Extra information regarding this error.
    - `[any key]` · any — map of additional properties
- `ref` · string · **Required** — A reference to the request that caused the error.
- `status` · integer · **Required** — The HTTP status code

Example:

```json
{
  "error": {
    "code": "string",
    "detail": "string",
    "extraDetail": {
      "key": null
    }
  },
  "ref": "string",
  "status": 0
}
```

---

Source spec: `media-api` · operationId: `[get]_/api/v1/projects/{project_name}/media/storage`
