---
updatedAt: 2025-11-03T17:53:26.000Z
agentTools:
  projectIndex: https://docs.gupshup.io/llms.txt
---

# Upload Template Media

Use this API to upload your sample media and generate a ***handleId*** for it

> ❗️ Attention
>
> This guide is no longer maintained from 31st Jan 2025. Please refer the updated one [here](https://partner-docs.gupshup.io/docs/gupshup-partner-eco-system).

<br />

Using the ***handleId***, you can create and submit a template along with a sample media. The handleId is passed in the ***exampleMedia*** parameter of the ***Apply for templates with sample media*** API.

### Parameters

| Key           | Description                                                               | Required/Optional | Type      | Value                     |
| :------------ | :------------------------------------------------------------------------ | :---------------- | :-------- | :------------------------ |
| Authorization | Access Token for the application                                          | Required          | String    | \{\{PARTNER\_APP\_TOKEN}} |
| appId         | Unique identifier of the app.                                             | Required          | String    | \{\{APP\_ID}}             |
| file          | Upload a file from your local machine or add the public URL to the media. | Required          | File path | \{\{FILE\_PATH}}          |
| file type     | Upload a file from your local machine.                                    | Required          | String    | \{\{FILE\_TYPE}}          |

### Sample Request

```curl
curl --location --request POST 'https://partner.gupshup.io/partner/app/{{APP_ID}}/upload/media' \
--header 'Authorization: {{PARTNER_APP_TOKEN}}' \
--form 'file_type="{{FILE_TYPE}}"' \
--form 'file=@"{{FILE_PATH}}'
```

OR

```curl
curl --location --request POST 'https://partner.gupshup.io/partner/app/{{APP_ID}}/upload/media' \
--header 'Authorization: {{PARTNER_APP_TOKEN}}' \
--form 'file_type="{{FILE_TYPE}}"' \
--form 'file="{{MEDIA_URL}}'
```

### Sample Response

```json
   {
        "handleId": {
        "message": "4::aW1h*****G5n:ARYY-6d3******0RG7nG1d-Rie7-q4*****M_Fcffdkv7glkYgGa0IxKLc9DqlyuVIQD18KxYmgaEfuiUuQSdbYMpjce0jPgI5*****5e5Q:e:1634970144:2******925530161:100033****35566:A*****lB5Nu6A5KJaI"
        },
        "status": "success"
   }
```

# OpenAPI definition

```json
{
  "openapi": "3.0.2",
  "info": {
    "title": "TemplateApis",
    "version": "1.0.0"
  },
  "servers": [
    {
      "url": "https://partner.gupshup.io"
    }
  ],
  "tags": [
    {
      "name": "App"
    }
  ],
  "paths": {
    "/partner/app/{appId}/upload/media": {
      "post": {
        "tags": [
          "App"
        ],
        "summary": "Upload template media",
        "description": "Using this API, you can upload your sample media and generate a ***handleId*** for it. Using the ***handleId***, you can create and submit a template along with a sample media. The handleId is passed in the ***exampleMedia*** parameter of the ***Apply for templates with sample media*** API.",
        "requestBody": {
          "content": {
            "multipart/form-data": {
              "schema": {
                "type": "object",
                "required": [
                  "file_type",
                  "file"
                ],
                "properties": {
                  "file_type": {
                    "type": "string",
                    "description": "Upload a file from your local machine.",
                    "example": "image/png"
                  },
                  "file": {
                    "type": "string",
                    "description": "Attach the file you want to upload here",
                    "format": "binary"
                  }
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "token",
            "in": "header",
            "schema": {
              "type": "string"
            },
            "required": true,
            "description": "Your app token, please refer [**Get access token api**](https://www.gupshup.io/docs/partner/#collapse-TokenApis-App_7CGetAccessToken) to get the token from partner documentation.",
            "example": "sk_61b3021c97214370b341f8baaae0xxxx"
          },
          {
            "name": "appId",
            "in": "path",
            "schema": {
              "type": "string"
            },
            "required": true,
            "description": "Unique identifier of the app.",
            "example": "9e97650d-xxxx-xxxx-xxxx-4cdf47c3fa68"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "title": "Upload template media response schema",
                  "type": "object",
                  "properties": {
                    "handleId": {
                      "type": "object",
                      "properties": {
                        "message": {
                          "type": "string",
                          "example": "4::cG5n:ARaUNs3E_0NGikafRDDUHYyuaOLAKsiQERpJiz5FDk8x14sOVxZJ5OfN-25gyTp_9imoMSqCXNqVB6wwPmWw7rGOGmNj-BiY-9ZmrPKR9cUxXQ:e:1696142166:2281283925530161:100033655335566:ARaB4RMvmxQkTDeeJYc"
                        }
                      }
                    },
                    "status": {
                      "type": "string",
                      "example": "success"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string",
                      "example": "Invalid app id provided"
                    },
                    "status": {
                      "type": "integer",
                      "example": 400
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string",
                      "example": "You do not have the required permissions to access this API"
                    },
                    "status": {
                      "type": "integer",
                      "example": 403
                    }
                  }
                }
              }
            }
          },
          "500": {
            "description": "Internal server error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string",
                      "example": "Internal error occured"
                    },
                    "status": {
                      "type": "integer",
                      "example": 500
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  },
  "x-readme": {
    "explorer-enabled": true,
    "proxy-enabled": true
  }
}
```