media
Attach media to authored statuses. See Using CounterSocial > Posting toots > Attachments for more information about size and format limits.
postUpload media as attachment
Creates an attachment to be used with a new status.
Returns: Attachment
OAuth: User token + write:media
Version history:
0.0.0 - added
2.3.0 - add focus
parameter
3.1.3 - deprecated in favor of POST /api/v2/media
, which is equal to v1 in all aspects, except it returns HTTP 202, and the returned JSON object has a url of null, because while the thumbnail is prepared synchronously, the full version of the media attachment will be processed in the background
3.2.0 - add thumbnail
parameter
Request
Headers
string
Form Data Parameters
object
object
string
string
Response
200: Success
Attachment created successfully. Note that the Attachment will be created even if the file is not understood correctly.
file correct
{
"id": "22348641",
"type": "image",
"url": "https://files.CounterSocial.social/media_attachments/files/022/348/641/original/cebc6d51be03e509.jpeg",
"preview_url": "https://files.CounterSocial.social/media_attachments/files/022/348/641/small/cebc6d51be03e509.jpeg",
"remote_url": null,
"text_url": "https://CounterSocial.social/media/4Zj6ewxzzzDi0g8JnZQ",
"meta": {
"focus": {
"x": -0.69,
"y": 0.42
},
"original": {
"width": 640,
"height": 480,
"size": "640x480",
"aspect": 1.3333333333333333
},
"small": {
"width": 461,
"height": 346,
"size": "461x346",
"aspect": 1.3323699421965318
}
},
"description": "test uploaded via api",
"blurhash": "UFBWY:8_0Jxv4mx]t8t64.%M-:IUWGWAt6M}"
}
file not correct
{
"id": "22348456",
"type": "unknown",
"url": "https://CounterSocial.social/files/original/missing.png",
"preview_url": "https://CounterSocial.social/files/small/missing.png",
"remote_url": null,
"text_url": "https://CounterSocial.social/media/Ao2nvQoQNHROpKgEyoA",
"meta": {
"focus": {
"x": -0.69,
"y": 0.42
}
},
"description": "test uploaded via api",
"blurhash": null
}
401: Unauthorized
Invalid or missing Authorization header
{
"error": "The access token is invalid"
}
422: Unprocessable Entity
File or file type is unsupported or invalid
{
"error": "Validation failed: File content type is invalid, File is invalid"
}