logo
Images

Generate image upload URL

Generate a presigned URL for uploading images.

POST
/images/upload-url

Authorization

x-kommunity-api-key<token>

In: header

Response Body

Successfully generated upload URL

TypeScript Definitions

Use the response body type in TypeScript.

successboolean
upload_urlstring

Presigned URL for uploading the image

image_urlstring

CDN URL where the image will be accessible after upload

Unauthorized - Invalid API key or missing permission

TypeScript Definitions

Use the response body type in TypeScript.

successboolean
Value in: false
errorstring

Server error

TypeScript Definitions

Use the response body type in TypeScript.

successboolean
Value in: false
errorstring
curl -X POST "/api/v1/images/upload-url" \
  -H "x-kommunity-api-key: <token>"
fetch("/api/v1/images/upload-url", {
  headers: {
    "x-kommunity-api-key": "<token>"
  }
})
package main

import (
  "fmt"
  "net/http"
  "io/ioutil"
)

func main() {
  url := "/api/v1/images/upload-url"

  req, _ := http.NewRequest("POST", url, nil)
  req.Header.Add("x-kommunity-api-key", "<token>")
  res, _ := http.DefaultClient.Do(req)
  defer res.Body.Close()
  body, _ := ioutil.ReadAll(res.Body)

  fmt.Println(res)
  fmt.Println(string(body))
}
import requests

url = "/api/v1/images/upload-url"

response = requests.request("POST", url, headers = {
  "x-kommunity-api-key": "<token>"
})

print(response.text)
{
  "success": true,
  "upload_url": "https://bucket-name.s3.amazonaws.com/image-key?AWSAccessKeyId=...",
  "image_url": "https://cdn.kommunity.app/image-key"
}
{
  "success": false,
  "error": "Invalid API key or missing permissions"
}
{
  "success": false,
  "error": "Failed to generate presigned URL"
}