---
updatedAt: 2025-02-14T21:20:25.000Z
agentTools:
  projectIndex: https://partner-docs.gupshup.io/llms.txt
---

# Upload Template Media

Use this API to 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.

### 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.3",
  "info": {
    "title": "Partner Portal Public APIs",
    "version": "1.0.0"
  },
  "servers": [
    {
      "url": "https://partner.gupshup.io"
    }
  ],
  "tags": [
    {
      "name": "App"
    }
  ],
  "paths": {
    "/partner/app/{appid}/upload/media": {
      "post": {
        "tags": [
          "App"
        ],
        "summary": "APP | Upload template media",
        "requestBody": {
          "content": {
            "multipart/form-data": {
              "schema": {
                "type": "object",
                "properties": {
                  "file_type": {
                    "type": "string",
                    "example": "pdf"
                  },
                  "file": {
                    "type": "string",
                    "format": "binary"
                  }
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "Authorization",
            "in": "header",
            "schema": {
              "type": "string"
            },
            "example": "{{PARTNER_APP_TOKEN}}"
          },
          {
            "name": "appid",
            "in": "path",
            "schema": {
              "type": "string"
            },
            "required": true,
            "example": "04e6c66b-bb95-4bfc-b75e-4e7391ddc680"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {}
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {}
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {}
            }
          },
          "500": {
            "description": "Internal server error",
            "content": {
              "application/json": {}
            }
          }
        }
      }
    }
  },
  "x-readme": {
    "explorer-enabled": true,
    "proxy-enabled": true
  }
}
```