Push - MIME Type Validation
Endpoint
/o/push/mime
Overview
Validates a media URL for push attachments and returns resolved URL, MIME type, and media size.
Authentication
Countly API supports three authentication methods:
api_key=YOUR_API_KEYauth_token=YOUR_AUTH_TOKENcountly-token: YOUR_AUTH_TOKEN
Permissions
Requires push Read permission.
Request Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
api_key | String | Conditional | Required if auth_token is not provided. |
auth_token | String | Conditional | Required if api_key is not provided. |
app_id | String | Yes | App ID used by permission validation. |
url | String | Yes | HTTP/HTTPS media URL to validate. |
Response
Success Response
{
"media": "https://cdn.example.com/assets/promo.png",
"mediaMime": "image/png",
"mediaSize": 2458624
}
Response Fields
| Field | Type | Description |
|---|---|---|
media | String | Final resolved URL used after redirects. |
mediaMime | String | MIME type from response headers. |
mediaSize | Number | Content length in bytes. |
Error Responses
400
{
"errors": [
"url is required"
]
}
400
{
"errors": [
"Invalid status 404"
]
}
400
{
"errors": [
"No content-type while HEADing the url"
]
}
400
{
"errors": [
"No content-length while HEADing the url"
]
}
400
{
"errors": [
"Media mime type \"video/avi\" is not supported"
]
}
400
{
"errors": [
"Media size (73400320) is too large"
]
}
Behavior/Processing
- Sends HEAD request first.
- Follows single redirect hop explicitly when status is
301or302andlocationexists. - Fails when final status is not
200. - Requires both
content-typeandcontent-lengthheaders. - If HEAD has no content-length, retries with GET and checks length again.
- Validates MIME type against allowed push media MIME list.
- Validates size against push media max size limit (
DEFAULTS.max_media_size).
Database Collections
This endpoint does not read or write database collections.
Examples
Validate attachment URL
/o/push/mime?
api_key=YOUR_API_KEY&
app_id=6991c75b024cb89cdc04efd2&
url=https://cdn.example.com/assets/promo.png
Related Endpoints
Last Updated
2026-04-09