Opengram

Upload media to a chat

Accepts multipart/form-data (with a file field) or application/json (with base64-encoded data). Body is parsed by a custom handler — see MediaUploadMultipart and MediaUploadJson schemas for the expected formats.

POST
/api/v1/chats/{chatId}/media

Authorization

bearerAuth
AuthorizationBearer <token>

Instance secret token

In: header

Path Parameters

chatId*string

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/json

application/json

application/json

application/json

application/json

application/json

application/json

application/json

curl -X POST "https://loading/api/v1/chats/abc123/media" \  -H "Content-Type: application/json" \  -d '{    "fileName": "string",    "contentType": "string",    "base64Data": "string"  }'
{
  "id": "string",
  "chat_id": "string",
  "message_id": "string",
  "storage_path": "string",
  "thumbnail_path": "string",
  "filename": "string",
  "content_type": "string",
  "byte_size": 0,
  "kind": "image",
  "created_at": "2019-08-24T14:15:22Z"
}
{
  "error": {
    "code": "VALIDATION_ERROR",
    "message": "Invalid request.",
    "details": null
  }
}
{
  "error": {
    "code": "VALIDATION_ERROR",
    "message": "Invalid request.",
    "details": null
  }
}
{
  "error": {
    "code": "VALIDATION_ERROR",
    "message": "Invalid request.",
    "details": null
  }
}
{
  "error": {
    "code": "VALIDATION_ERROR",
    "message": "Invalid request.",
    "details": null
  }
}
{
  "error": {
    "code": "VALIDATION_ERROR",
    "message": "Invalid request.",
    "details": null
  }
}
{
  "error": {
    "code": "VALIDATION_ERROR",
    "message": "Invalid request.",
    "details": null
  }
}
{
  "error": {
    "code": "VALIDATION_ERROR",
    "message": "Invalid request.",
    "details": null
  }
}
{
  "error": {
    "code": "VALIDATION_ERROR",
    "message": "Invalid request.",
    "details": null
  }
}