# Get all images from asset library for a certain subfolder (or folder) using Admin API

**URL:** <https://forum.builder.io/t/get-all-images-from-asset-library-for-a-certain-subfolder-or-folder-using-admin-api/15761>\
**Category:** Technical Questions\
**Tags:** api\
**Created:** [September 13, 2025, 12:14am UTC](https://forum.builder.io/t/get-all-images-from-asset-library-for-a-certain-subfolder-or-folder-using-admin-api/15761 "2025-09-13T00:14:42Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![elir-usafacts](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.builder.io/elir-usafacts/32/5155_2.png) [@elir-usafacts](https://forum.builder.io/u/elir-usafacts)\
**Post date:** [September 13, 2025, 12:14am UTC](https://forum.builder.io/t/get-all-images-from-asset-library-for-a-certain-subfolder-or-folder-using-admin-api/15761/1 "2025-09-13T00:14:42Z")

</div>

I’m wondering if it’s possible to query the asset library to get all images from a subfolder, preferably of a specific mimetype.

Here’s my code, this code returns “any” images if you get rid of the variables passed to the query, however it doesn’t work if I add in the mimetype or folder id

```typescript
const assetsQuery = query GetSvgAssets($q: JSONObject) {
  assets(
    input: {
      query: $q,
      sort: {createdDate: “descending”}
    }
  ) {
    id
    name
    url
    bytes
    lastUsed
  }
};

const assetsRequestBody = {
  query: assetsQuery,
  variables: {
    q: {
      folderId: { $eq: folderId },
      mimeType: { $eq: ‘image/svg+xml’ },
    },
  },
};

```

The documentation doesn’t provide enough examples and detail to help so far.

---

<div class="post-metadata">

**Author:** ![manish-sharma](https://avatars.discourse-cdn.com/v4/letter/m/8797f3/32.png) [@manish-sharma](https://forum.builder.io/u/manish-sharma)\
**Post date:** [September 15, 2025, 1:47pm UTC](https://forum.builder.io/t/get-all-images-from-asset-library-for-a-certain-subfolder-or-folder-using-admin-api/15761/2 "2025-09-15T13:47:36Z")

</div>

Hello @elir-usafacts,

The reason your first query fails with `folderId` and `mimeType` is because those fields don’t exist directly on the `Asset` object in the GraphQL schema.

Instead:

- The **folder** is stored as an array of `folders` (IDs).

- The **mimeType** is stored as `type` (e.g., `"image/svg+xml"`).

So your query should look like this:

```graphql
query ($input: QueryAssetsInput!) {
  assets(input: $input) {
    id
    name
    url
    type
    folders
    createdDate
  }
}

```

```json
{
  "input": {
    "query": {
      "type": { "$eq": "image/svg+xml" },
      "folders": { "$in": ["2537151df1354a728576310e86bae161"] }
    },
    "sort": { "createdDate": -1 },
    "limit": 50
  }
}

```

This will return only SVG assets inside the specified folder.

You can also test this directly in a GraphQL editor using the endpoint:  
`https://cdn.builder.io/api/v2/admin`

Here’s a full example query that we tested and confirmed works:

```graphql
{
  "query": "query ($input: QueryAssetsInput!) { assets(input: $input) { id name ownerId folders createdDate type url } }",
  "variables": {
    "input": {
      "query": {
        "type": { "$eq": "image/svg+xml" },
        "folders": { "$in": ["2537151df1354a728576310e86bae161"] }
      },
      "sort": {
        "createdDate": -1
      },
      "limit": 20
    }
  }
}

```

> **[Assets API](https://www.builder.io/c/docs/assets-api)**
>
> Efficiently manage user assets with the Assets API. Learn implementation, key features, and best practices for seamless integration.

> **[Admin GraphQL Schema](https://www.builder.io/c/docs/admin-graphql-schema)**
>
> Admin GraphQL schema documentation, including queries, mutations, object types, input types, and scalars, along with examples of how to use them.

We hope this helps!

Thanks,

---

<div class="post-metadata">

**Author:** ![elir-usafacts](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.builder.io/elir-usafacts/32/5155_2.png) [@elir-usafacts](https://forum.builder.io/u/elir-usafacts)\
**Post date:** [September 15, 2025, 9:58pm UTC](https://forum.builder.io/t/get-all-images-from-asset-library-for-a-certain-subfolder-or-folder-using-admin-api/15761/3 "2025-09-15T21:58:43Z")

</div>

That worked, thank you. I couldn’t use the builder explorer as it was throwing exceptions. Would it be possible to add these shapes of these endpoints to documentation?

> **[Builder Admin API](https://www.builder.io/c/docs/admin-graphql-api#get-assets)**
>
> Explore Builder.io's Admin API, a GraphQL-based tool for backend servers to perform administrative tasks and manage content programmatically.

---

<div class="post-metadata">

**Author:** ![manish-sharma](https://avatars.discourse-cdn.com/v4/letter/m/8797f3/32.png) [@manish-sharma](https://forum.builder.io/u/manish-sharma)\
**Post date:** [September 16, 2025, 10:56am UTC](https://forum.builder.io/t/get-all-images-from-asset-library-for-a-certain-subfolder-or-folder-using-admin-api/15761/4 "2025-09-16T10:56:26Z")

</div>

> [@elir-usafacts](#):
>
> That worked, thank you. I couldn’t use the builder explorer as it was throwing exceptions. Would it be possible to add these shapes of these endpoints to documentation?

Hello @elir-usafacts,

I’m glad to hear that worked for you!

We’ve submitted a request to update the documentation with a working example that includes the shapes of these endpoints. You can expect the docs to be updated in the coming days.

Thank you for bringing this to our attention—it will help improve the experience for everyone.

Thanks,
