---
title: "Batch create/modify asset content"
description: "batch create or update asset file api"
doc_type: openapi
doc_category: openapi
doc_version: v20270301
source_url:
  html: 'https://developer.shopline.com/docs/admin-rest-api/online-store/asset/batch-create-modify-asset-content'
  md: 'https://developer.shopline.com/docs/admin-rest-api/online-store/asset/batch-create-modify-asset-content.md'
---
# Batch create/modify asset content

batch create or update asset file api

- **Base URL:** `https://{handle}.myshopline.com/admin/openapi`
- **Required Scopes:** `write_themes`
- **API Version:** v20270301
- **API Type:** Admin
- **API Protocol:** RESTful

## Endpoint

```http
POST /themes/:theme_id/batch-assets.json
```

## Base URL

* `https://{handle}.myshopline.com/admin/openapi`

  * `{handle}`: `handle` : The store's unique identifier, which is the prefix of the store's domain name. For example, if a store's domain name is `open001.myshopline.com` , the store handle is `open001` .

## Required Permissions

* `write_themes`

## Request

### Path Parameters

* `theme_id`

  string (required)

  Theme id

### Request Headers

* `Content-Type`

  string (required)

  The field must be set to the fixed value `application/json; charset=utf-8`.

* `Authorization`

  string (required)

   The access token for the API resource. Refer to [App authorization](https://developer.shopline.com/docs/apps/api-instructions-for-use/app-authorization.md?lang=en) to obtain the access token, and then pass the obtained token in the Bearer format. 

### Request Body

* `assets`

  array<object>

  File list

  * `src`

    string

    Resource link ( value、src、attachment、source_key four fields can only be transferred to one )

  * `value`

    string

    File content ( value、src、attachment、source_key four fields can only be transferred to one of them )

  * `attachment`

    string

    Image base64 content ( value、src、attachment three fields can only be transferred to one of them )

  * `key`

    string

    File name

## Response

### Status Codes

* `200`

  For the complete list of codes and messages, see [Http status code](https://developer.shopline.com/docs/apps/api-instructions-for-use/http-status-code.md?lang=en).

* `401`

  

* `429`

  

### Response Headers

* `traceId`

  A globally unique identifier for the request. It is used to track the request flow throughout the system, allowing for easy location and debugging when issues arise.

### Response Body

#### 200

* `assets`

  array<object>

  File list

  * `size`

    integer

    File size

  * `theme_id`

    string

    Theme id

  * `updated_at`

    long

    Update time

  * `checksum`

    string

    Check value

  * `content_type`

    string

    File type

  * `created_at`

    long

    Creation time

  * `key`

    string

    File name

  * `public_url`

    string

    Resources url


#### 401

* `errors`

  string

  Error message. 


#### 429

* `errors`

  string

  Error message. 


## OpenAPI Definition

```json
{
  "description": "batch create or update asset file api",
  "externalDocs": {
    "description": "Permission point used by the interface is `write_themes` , For more information about the use of permission points, see",
    "url": "ec20/3cv5d7wpfgr6a8z5/xabczf5442284vkq?lang=en",
    "errorTableDescription": ""
  },
  "operationId": "uunEZSYT",
  "parameters": [
    {
      "name": "theme_id",
      "in": "path",
      "description": "Theme id",
      "required": true,
      "style": "simple",
      "schema": {
        "name": "theme_id",
        "description": "Theme id",
        "type": "string",
        "example": ""
      },
      "example": ""
    },
    {
      "name": "Content-Type",
      "in": "header",
      "description": "The field must be set to the fixed value `application/json; charset=utf-8`.",
      "required": true,
      "style": "string",
      "schema": {
        "name": "Content-Type",
        "type": "string",
        "example": "application/json; charset=utf-8"
      }
    },
    {
      "name": "Authorization",
      "in": "header",
      "description": " The access token for the API resource. Refer to [App authorization](https://developer.shopline.com/docs/apps/api-instructions-for-use/app-authorization.md?lang=en) to obtain the access token, and then pass the obtained token in the Bearer format. ",
      "required": true,
      "style": "string",
      "schema": {
        "name": "Authorization",
        "description": " The access token for the API. Please refer to [App authorization](https://developer.shopline.com/docs/apps/api-instructions-for-use/app-authorization.md?lang=en) to obtain the access token, and then put the obtained access token into the API request header in Bearer Token.",
        "type": "string",
        "example": "Bearer eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJhcHBJZCI6MCwiYXBwS2V5IjoiNzU2ZjI1NWE2NjdlZTcwNTk1MzM0ZjVjYzk4NzU5MzBmN2E3NGZjMSIsImV4cCI6MTg3OTQ4MjA3NiwiaXNzIjoieXNvdWwiLCJzZWxsZXJJZCI6IjIwMDAyMzQ4ODAiLCJzdG9yZUlkIjoiMTY3MjM2OTcyOTYwNiIsInRpbWVzdGFtcCI6MTc4NDc4NzY3NjY2MSwidmVyc2lvbiI6IlYyIn0.3ZzbGAH4cLU1QR2VPEvMOQInUDvus-C4amkINSQIPuNVlXsFKj0sAt1c0KnUy9MWUOFV9cHlkf7J90r2y1FzpA"
      },
      "example": "Bearer eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJhcHBJZCI6MCwiYXBwS2V5IjoiNzU2ZjI1NWE2NjdlZTcwNTk1MzM0ZjVjYzk4NzU5MzBmN2E3NGZjMSIsImV4cCI6MTg3OTQ4MjA3NiwiaXNzIjoieXNvdWwiLCJzZWxsZXJJZCI6IjIwMDAyMzQ4ODAiLCJzdG9yZUlkIjoiMTY3MjM2OTcyOTYwNiIsInRpbWVzdGFtcCI6MTc4NDc4NzY3NjY2MSwidmVyc2lvbiI6IlYyIn0.3ZzbGAH4cLU1QR2VPEvMOQInUDvus-C4amkINSQIPuNVlXsFKj0sAt1c0KnUy9MWUOFV9cHlkf7J90r2y1FzpA"
    }
  ],
  "requestBody": {
    "content": {
      "application/json": {
        "schema": {
          "type": "object",
          "properties": {
            "assets": {
              "name": "assets",
              "description": "File list",
              "type": "array",
              "items": {
                "name": "assets",
                "description": "File list",
                "type": "object",
                "properties": {
                  "src": {
                    "name": "src",
                    "description": "Resource link ( value、src、attachment、source_key four fields can only be transferred to one )",
                    "type": "string",
                    "example": "https://cdn.myshopline.com/assets/blog.css"
                  },
                  "value": {
                    "name": "value",
                    "description": "File content ( value、src、attachment、source_key four fields can only be transferred to one of them )",
                    "type": "string",
                    "example": "file_content"
                  },
                  "attachment": {
                    "name": "attachment",
                    "description": "Image base64 content ( value、src、attachment three fields can only be transferred to one of them )",
                    "type": "string",
                    "example": "base64_content"
                  },
                  "key": {
                    "name": "key",
                    "description": "File name",
                    "type": "string",
                    "example": "templates/index.test.json"
                  }
                },
                "required": [
                  "key"
                ],
                "example": {
                  "key": "templates/index.test.json",
                  "src": "https://cdn.myshopline.com/assets/blog.css",
                  "value": "file_content",
                  "attachment": "base64_content"
                }
              },
              "example": [
                {
                  "attachment": "base64_content",
                  "key": "templates/index.test.json",
                  "src": "https://cdn.myshopline.com/assets/blog.css",
                  "value": "file_content"
                }
              ]
            }
          },
          "required": [
            "assets"
          ],
          "example": {
            "assets": [
              {
                "src": "https://cdn.myshopline.com/assets/blog.css",
                "value": "file_content",
                "attachment": "base64_content",
                "key": "templates/index.test.json"
              }
            ]
          }
        }
      }
    },
    "required": true
  },
  "responses": {
    "200": {
      "description": "For the complete list of codes and messages, see [Http status code](https://developer.shopline.com/docs/apps/api-instructions-for-use/http-status-code.md?lang=en).",
      "headers": {
        "traceId": {
          "description": "A globally unique identifier for the request. It is used to track the request flow throughout the system, allowing for easy location and debugging when issues arise."
        }
      },
      "content": {
        "application/json": {
          "schema": {
            "type": "object",
            "properties": {
              "assets": {
                "name": "assets",
                "description": "File list",
                "type": "array",
                "items": {
                  "name": "assets",
                  "description": "File list",
                  "type": "object",
                  "properties": {
                    "size": {
                      "name": "size",
                      "description": "File size",
                      "type": "integer",
                      "example": 500
                    },
                    "theme_id": {
                      "name": "theme_id",
                      "description": "Theme id",
                      "type": "string",
                      "example": "66012436ec4cd35a973324c4"
                    },
                    "updated_at": {
                      "name": "updated_at",
                      "description": "Update time",
                      "type": "long",
                      "example": 1712043467793
                    },
                    "checksum": {
                      "name": "checksum",
                      "description": "Check value",
                      "type": "string",
                      "example": "660BB5CB379F2D68816F4050"
                    },
                    "content_type": {
                      "name": "content_type",
                      "description": "File type",
                      "type": "string",
                      "example": "text/css"
                    },
                    "created_at": {
                      "name": "created_at",
                      "description": "Creation time",
                      "type": "long",
                      "example": 1712043467793
                    },
                    "key": {
                      "name": "key",
                      "description": "File name",
                      "type": "string",
                      "example": "assets/blog.css"
                    },
                    "public_url": {
                      "name": "public_url",
                      "description": "Resources url",
                      "type": "string",
                      "example": "https://cdn.myshopline.com/assets/blog.css"
                    }
                  },
                  "example": {
                    "key": "assets/blog.css",
                    "public_url": "https://cdn.myshopline.com/assets/blog.css",
                    "size": 500,
                    "theme_id": "66012436ec4cd35a973324c4",
                    "updated_at": 1712043467793,
                    "checksum": "660BB5CB379F2D68816F4050",
                    "content_type": "text/css",
                    "created_at": 1712043467793
                  }
                },
                "example": [
                  {
                    "key": "assets/blog.css",
                    "public_url": "https://cdn.myshopline.com/assets/blog.css",
                    "size": 500,
                    "theme_id": "66012436ec4cd35a973324c4",
                    "updated_at": 1712043467793,
                    "checksum": "660BB5CB379F2D68816F4050",
                    "content_type": "text/css",
                    "created_at": 1712043467793
                  }
                ]
              }
            },
            "example": {
              "assets": [
                {
                  "created_at": 1712043467793,
                  "key": "assets/blog.css",
                  "public_url": "https://cdn.myshopline.com/assets/blog.css",
                  "size": 500,
                  "theme_id": "66012436ec4cd35a973324c4",
                  "updated_at": 1712043467793,
                  "checksum": "660BB5CB379F2D68816F4050",
                  "content_type": "text/css"
                }
              ]
            }
          }
        }
      }
    },
    "401": {
      "headers": {
        "traceId": {
          "description": "A globally unique identifier for the request. It is used to track the request flow throughout the system, allowing for easy location and debugging when issues arise."
        }
      },
      "content": {
        "application/json": {
          "schema": {
            "type": "object",
            "properties": {
              "errors": {
                "description": "Error message. ",
                "type": "string"
              }
            },
            "required": [
              "errors"
            ]
          }
        }
      }
    },
    "429": {
      "headers": {
        "traceId": {
          "description": "A globally unique identifier for the request. It is used to track the request flow throughout the system, allowing for easy location and debugging when issues arise."
        }
      },
      "content": {
        "application/json": {
          "schema": {
            "type": "object",
            "properties": {
              "errors": {
                "description": "Error message. ",
                "type": "string"
              }
            },
            "required": [
              "errors"
            ]
          }
        }
      }
    }
  },
  "security": [
    {
      "oauth2": []
    }
  ],
  "method": "post",
  "path": "/themes/:theme_id/batch-assets.json",
  "servers": [
    {
      "url": "https://{handle}.myshopline.com/admin/openapi",
      "variables": {
        "handle": {
          "default": "openapiceshidianpu",
          "description": "`handle` : The store's unique identifier, which is the prefix of the store's domain name. For example, if a store's domain name is `open001.myshopline.com` , the store handle is `open001` ."
        }
      }
    }
  ],
  "info": {
    "title": "Batch create/modify asset content",
    "version": "v20270301"
  },
  "authIndexes": [
    "write_themes"
  ]
}
```