# Media Admin API running into issue

**URL:** <https://forum.litium.com/t/media-admin-api-running-into-issue/3532>\
**Category:** Questions\
**Tags:** litium-8\
**Created:** [November 4, 2025, 8:36am UTC](https://forum.litium.com/t/media-admin-api-running-into-issue/3532 "2025-11-04T08:36:43Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![vishnu\_kj](https://yyz2.discourse-cdn.com/flex030/user_avatar/forum.litium.com/vishnu_kj/32/685_2.png) [@vishnu\_kj](https://forum.litium.com/u/vishnu_kj)\
**Post date:** [November 4, 2025, 8:36am UTC](https://forum.litium.com/t/media-admin-api-running-into-issue/3532/1 "2025-11-04T08:36:43Z")

</div>

_We are working on the latest_ **Litium Empty Web** accelerator project with latest storefront

We’re trying to upload media using the Admin API but are running into issues.  
A `PUT` request to `/Litium/api/admin/media/files/{systemId}/upload` returns a 404.

A `POST` request to `/Litium/api/admin/media/files` requires a `blobUri`.

Please provide documentation or a working example of how to upload media files using the Admin API.

Litium version: _[8.24.1]_

---

<div class="post-metadata">

**Author:** ![utku](https://yyz2.discourse-cdn.com/flex030/user_avatar/forum.litium.com/utku/32/62_2.png) [@utku](https://forum.litium.com/u/utku)\
**Post date:** [November 6, 2025, 9:53am UTC](https://forum.litium.com/t/media-admin-api-running-into-issue/3532/2 "2025-11-06T09:53:18Z")

</div>

Hi, did you try with /litium/api/admin/media/files/{{systemId}/upload? Not capital letter at the beginning. I don’t know if it affects but worth for a try 🙂 Did you try it with Postman? Otherwise create a ticket by sending a mail to [support@litium.com](mailto:support@litium.com) so that we can handle your case.

---

<div class="post-metadata">

**Author:** ![vishnu\_kj](https://yyz2.discourse-cdn.com/flex030/user_avatar/forum.litium.com/vishnu_kj/32/685_2.png) [@vishnu\_kj](https://forum.litium.com/u/vishnu_kj)\
**Post date:** [November 11, 2025, 12:00pm UTC](https://forum.litium.com/t/media-admin-api-running-into-issue/3532/3 "2025-11-11T12:00:49Z")

</div>

Tried with postman and swagger. Got 404 error. Will send a ticket to support

---

<div class="post-metadata">

**Author:** ![vishnu\_kj](https://yyz2.discourse-cdn.com/flex030/user_avatar/forum.litium.com/vishnu_kj/32/685_2.png) [@vishnu\_kj](https://forum.litium.com/u/vishnu_kj)\
**Post date:** [November 24, 2025, 6:30am UTC](https://forum.litium.com/t/media-admin-api-running-into-issue/3532/4 "2025-11-24T06:30:27Z")

</div>

We managed to sort it out — we first created the file using the POST endpoint and used a `blobUri` in the format `litium.blob://media/[systemid-with-dashes-removed]`. After that, the PUT upload worked as expected.  
It would still be very helpful to have accessible documentation covering this flow, especially around generating the `blobUri` and the correct sequence for creating and uploading media.

---

<div class="post-metadata">

**Author:** ![patric.forsgard](https://yyz2.discourse-cdn.com/flex030/user_avatar/forum.litium.com/patric.forsgard/32/10_2.png) [@patric.forsgard](https://forum.litium.com/u/patric.forsgard)\
**Post date:** [November 24, 2025, 7:44am UTC](https://forum.litium.com/t/media-admin-api-running-into-issue/3532/5 "2025-11-24T07:44:05Z")

</div>

First create the file in the folder,

```json
{
  "fields": {
    "_nameInvariantCulture": {
      "*": "img.jpg"
    },
  },
  "fieldTemplateSystemId": "409f72c2-cea9-4917-8d60-39d475e2c565",
  "folderSystemId": "fa416bd4-33f4-414f-97d8-669e7c91e27f"
}

```

Complete request with curl

```bash
curl -X POST "https://demoadmin.litium.com/Litium/api/admin/media/files" -H "accept: */*" -H "Authorization: Bearer YOUR_TOKEN" -H "Content-Type: application/json" -d "{ \"fields\": { \"_nameInvariantCulture\": { \"*\": \"img.jpg\" }, }, \"fieldTemplateSystemId\": \"409f72c2-cea9-4917-8d60-39d475e2c565\", \"folderSystemId\": \"fa416bd4-33f4-414f-97d8-669e7c91e27f\"}"

```

Response

```json
{
  "accessControlList": [
    {
      "groupSystemId": "5b521f8c-a7a2-44e0-ab76-1c60d740bded",
      "operation": "Entity/Read"
    }
  ],
  "fields": {
    "_nameInvariantCulture": {
      "*": "img.jpg"
    }
  },
  "fieldTemplateSystemId": "409f72c2-cea9-4917-8d60-39d475e2c565",
  "folderSystemId": "fa416bd4-33f4-414f-97d8-669e7c91e27f",
  "systemId": "293b8e24-6b21-42d4-b7bb-a6b9087c4c36",
  "trashCanStatus": 1
}

```

Upload the image to the file, this is a `multipart/form-data` request, not a regular `application/json` request

```bash
curl -X PUT "https://demoadmin.litium.com/Litium/api/admin/media/files/293b8e24-6b21-42d4-b7bb-a6b9087c4c36/upload" -H "accept: */*" -H "Authorization: Bearer YOUR_TOKEN" -H "Content-Type: multipart/form-data" -F "fileName=@/path/to/your/file.jpg"

```

AI generated c# version of above

```csharp

using System;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Text.Json;
using System.Threading.Tasks;

class Program
{
    static async Task Main()
    {
        var token = "YOUR_TOKEN";
        var baseUrl = "https://demoadmin.litium.com/Litium/api/admin/media/files";

        using var client = new HttpClient();
        client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
        client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("*/*"));

        // 1) Create media file
        var json = @"{
            ""fields"": {
                ""_nameInvariantCulture"": { ""*"": ""img.jpg"" }
            },
            ""fieldTemplateSystemId"": ""409f72c2-cea9-4917-8d60-39d475e2c565"",
            ""folderSystemId"": ""fa416bd4-33f4-414f-97d8-669e7c91e27f""
        }";

        var createResponse = await client.PostAsync(baseUrl,
            new StringContent(json, Encoding.UTF8, "application/json"));
        createResponse.EnsureSuccessStatusCode();

        var createContent = await createResponse.Content.ReadAsStringAsync();

        // ✅ Extract systemId using System.Text.Json
        using var doc = JsonDocument.Parse(createContent);
        var root = doc.RootElement;
        var systemId = root.GetProperty("systemId").GetString();

        if (string.IsNullOrWhiteSpace(systemId))
        {
            throw new InvalidOperationException("systemId not found in response.");
        }

        // 2) Upload file
        var uploadUrl = $"{baseUrl}/{systemId}/upload";
        using var form = new MultipartFormDataContent();
        var filePath = @"C:\path\to\your\file.jpg";
        using var fileStream = System.IO.File.OpenRead(filePath);
        form.Add(new StreamContent(fileStream), "fileName", "file.jpg");

        var uploadResponse = await client.PutAsync(uploadUrl, form);
        uploadResponse.EnsureSuccessStatusCode();

        var uploadContent = await uploadResponse.Content.ReadAsStringAsync();
        Console.WriteLine("Upload Response: " + uploadContent);
    }
}

```

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex030/uploads/litium/original/1X/12eddac3b8b661de1db86af10ac8151b571e6fb9.png) [@system](https://forum.litium.com/u/system)\
**Post date:** [December 22, 2025, 7:44am UTC](https://forum.litium.com/t/media-admin-api-running-into-issue/3532/6 "2025-12-22T07:44:45Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
