> For clean Markdown of any page, append .md to the page URL. > For a complete documentation index, see https://docs.gorilladash.com/gorilla-dash-rest-ful-api/website-content/website-content-media/upload-media/llms.txt. > For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.gorilladash.com/_mcp/server. # Upload Media POST https://api.gorilladash.com/api/v1/website-content/media Content-Type: multipart/form-data Uploads one image to the media library. Needs a key with **Website Content: Read and Write** (`website-content:write`). Send the body as **form-data**, not JSON. In Postman, choose the file in the `file` row. **Uploading the same image twice.** When you send a `source_url` and a live media item already has that `source_url`, the existing item is returned and the new file is discarded, so a re-run does not fill the library with copies. A `name` or `alt` you send updates the existing item. Without a `source_url`, every upload stores a new item. Two uploads with the same `source_url` at the same moment wait for each other. If one waits more than about 10 seconds it returns **409** and nothing is stored; send it again. Reference: https://docs.gorilladash.com/gorilla-dash-rest-ful-api/website-content/website-content-media/upload-media ## Request ### Headers - `GorillaDash-Api-Key` (string, optional) — Gorilla Dash API Key - `GorillaDash-Api-Secret` (string, optional) — Gorilla Dash API Secret ### Body (multipart/form-data) This endpoint expects a multipart form containing a file. - `file` (file, required) — Required. JPEG, PNG, GIF or WebP, up to 20 MB. SVG and anything else returns 422. - `name` (string, required) — Optional, max 255. Defaults to the file name without its extension. - `alt` (string, required) — Optional, max 255. - `source_url` (string, required) — Optional, max 2048. A label only; Gorilla Dash never downloads it. ## Response ### 201 Created - `success` (boolean, required) - `status` (integer, required) - `data` (ApiV1WebsiteContentMediaPostResponsesContentApplicationJsonSchemaData, required) ## Errors ### 409 Conflict Error Conflict - `message` (string, required) ### 422 Unprocessable Entity Error Unprocessable Content - `message` (string, required) - `errors` (ApiV1WebsiteContentMediaPostResponsesContentApplicationJsonSchemaErrors, required) ## Types ### ApiV1WebsiteContentMediaPostResponsesContentApplicationJsonSchemaData - `id` (integer, required) - `name` (string, required) - `alt` (string, required) - `url` (string, required) - `source_url` (string, required) - `created_at` (datetime, required) - `updated_at` (datetime, required) ### ApiV1WebsiteContentMediaPostResponsesContentApplicationJsonSchemaErrors - `file` (list of string, required) ## Examples **Request** ```json { "alt": "string", "file": "", "name": "string", "source_url": "string" } ``` **Response** ```json { "success": true, "status": 201, "data": { "id": 812, "name": "board", "alt": "The board", "url": "https://cdn.gorilladash.com/media/812/board.jpg", "source_url": "https://franchise.example.org/wp-content/uploads/board.jpg", "created_at": "2026-10-07T01:20:00+00:00", "updated_at": "2026-10-07T01:20:00+00:00" } } ``` **SDK Code** ```python Website Content_Website Content > Media_Upload Media_example import requests url = "https://api.gorilladash.com/api/v1/website-content/media" files = { "file": "open('string', 'rb')" } payload = { "alt": "string", "name": "string", "source_url": "string" } headers = { "GorillaDash-Api-Key": "{{API_KEY}}", "GorillaDash-Api-Secret": "{{GD_RESTFUL_SECRET}}" } response = requests.post(url, data=payload, files=files, headers=headers) print(response.json()) ``` ```javascript Website Content_Website Content > Media_Upload Media_example const url = 'https://api.gorilladash.com/api/v1/website-content/media'; const form = new FormData(); form.append('alt', 'string'); form.append('file', 'string'); form.append('name', 'string'); form.append('source_url', 'string'); const options = { method: 'POST', headers: { 'GorillaDash-Api-Key': '{{API_KEY}}', 'GorillaDash-Api-Secret': '{{GD_RESTFUL_SECRET}}' } }; options.body = form; try { const response = await fetch(url, options); const data = await response.json(); console.log(data); } catch (error) { console.error(error); } ``` ```go Website Content_Website Content > Media_Upload Media_example package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://api.gorilladash.com/api/v1/website-content/media" payload := strings.NewReader("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"alt\"\r\n\r\nstring\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"string\"\r\nContent-Type: application/octet-stream\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"name\"\r\n\r\nstring\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"source_url\"\r\n\r\nstring\r\n-----011000010111000001101001--\r\n") req, _ := http.NewRequest("POST", url, payload) req.Header.Add("GorillaDash-Api-Key", "{{API_KEY}}") req.Header.Add("GorillaDash-Api-Secret", "{{GD_RESTFUL_SECRET}}") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` ```ruby Website Content_Website Content > Media_Upload Media_example require 'uri' require 'net/http' url = URI("https://api.gorilladash.com/api/v1/website-content/media") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Post.new(url) request["GorillaDash-Api-Key"] = '{{API_KEY}}' request["GorillaDash-Api-Secret"] = '{{GD_RESTFUL_SECRET}}' request.body = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"alt\"\r\n\r\nstring\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"string\"\r\nContent-Type: application/octet-stream\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"name\"\r\n\r\nstring\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"source_url\"\r\n\r\nstring\r\n-----011000010111000001101001--\r\n" response = http.request(request) puts response.read_body ``` ```java Website Content_Website Content > Media_Upload Media_example import com.mashape.unirest.http.HttpResponse; import com.mashape.unirest.http.Unirest; HttpResponse response = Unirest.post("https://api.gorilladash.com/api/v1/website-content/media") .header("GorillaDash-Api-Key", "{{API_KEY}}") .header("GorillaDash-Api-Secret", "{{GD_RESTFUL_SECRET}}") .body("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"alt\"\r\n\r\nstring\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"string\"\r\nContent-Type: application/octet-stream\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"name\"\r\n\r\nstring\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"source_url\"\r\n\r\nstring\r\n-----011000010111000001101001--\r\n") .asString(); ``` ```php Website Content_Website Content > Media_Upload Media_example request('POST', 'https://api.gorilladash.com/api/v1/website-content/media', [ 'multipart' => [ [ 'name' => 'alt', 'contents' => 'string' ], [ 'name' => 'file', 'filename' => 'string', 'contents' => null ], [ 'name' => 'name', 'contents' => 'string' ], [ 'name' => 'source_url', 'contents' => 'string' ] ] 'headers' => [ 'GorillaDash-Api-Key' => '{{API_KEY}}', 'GorillaDash-Api-Secret' => '{{GD_RESTFUL_SECRET}}', ], ]); echo $response->getBody(); ``` ```csharp Website Content_Website Content > Media_Upload Media_example using RestSharp; var client = new RestClient("https://api.gorilladash.com/api/v1/website-content/media"); var request = new RestRequest(Method.POST); request.AddHeader("GorillaDash-Api-Key", "{{API_KEY}}"); request.AddHeader("GorillaDash-Api-Secret", "{{GD_RESTFUL_SECRET}}"); request.AddParameter("undefined", "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"alt\"\r\n\r\nstring\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"string\"\r\nContent-Type: application/octet-stream\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"name\"\r\n\r\nstring\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"source_url\"\r\n\r\nstring\r\n-----011000010111000001101001--\r\n", ParameterType.RequestBody); IRestResponse response = client.Execute(request); ``` ```swift Website Content_Website Content > Media_Upload Media_example import Foundation let headers = [ "GorillaDash-Api-Key": "{{API_KEY}}", "GorillaDash-Api-Secret": "{{GD_RESTFUL_SECRET}}" ] let parameters = [ [ "name": "alt", "value": "string" ], [ "name": "file", "fileName": "string" ], [ "name": "name", "value": "string" ], [ "name": "source_url", "value": "string" ] ] let boundary = "---011000010111000001101001" var body = "" var error: NSError? = nil for param in parameters { let paramName = param["name"]! body += "--\(boundary)\r\n" body += "Content-Disposition:form-data; name=\"\(paramName)\"" if let filename = param["fileName"] { let contentType = param["content-type"]! let fileContent = String(contentsOfFile: filename, encoding: String.Encoding.utf8) if (error != nil) { print(error as Any) } body += "; filename=\"\(filename)\"\r\n" body += "Content-Type: \(contentType)\r\n\r\n" body += fileContent } else if let paramValue = param["value"] { body += "\r\n\r\n\(paramValue)" } } let request = NSMutableURLRequest(url: NSURL(string: "https://api.gorilladash.com/api/v1/website-content/media")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0) request.httpMethod = "POST" request.allHTTPHeaderFields = headers request.httpBody = postData as Data let session = URLSession.shared let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in if (error != nil) { print(error as Any) } else { let httpResponse = response as? HTTPURLResponse print(httpResponse) } }) dataTask.resume() ```