Invalid media Id




We’re trying to upload in image for use in a Website Card but keep getting the following error when trying to check the status:

“request”: “/1.1/media/upload.json”,
“error”: “Invalid mediaId.”

The JSON returned from the original upload does return media_ids, we’ve tried passing both in:

Any ideas?

"error": "Invalid mediaId."

Has this just started happening, and is it happening consistently?


We’ve just started to hook this up and it’s happening every time, (only tried 3 times).


Hi, @SocialOpinions. Please provide the series of requests that are causing this, preferably using twurl, so that we can try to reproduce this error. Thanks!


Hi @juanshishido, I’m not using twurl but using a .net class to perform the rest api a calls:

Are the end points my class uses and here is an extract of the request headers for the call that fails from the .net class:

_HttpRequestHeaders = {Content-Type: application/x-www-form-urlencoded
Authorization: OAuth oauth_version=“1.0”,oauth_consumer_key="",oauth_nonce=“5EFD3BC67667E1117667E1117667E111”,oauth_signature_method=“HMAC-SHA1”,oauth_timestamp=“1473249764”,oauth_to…


@andypiper @juanshishido
We are having the exact same issues - all media uploads are failing.
A simple example:
twurl -H “/1.1/media/upload.json” -f ~/Pictures/IMG_3877.JPG -F media -X POST
that returns a media_id of 774281214865702912
but then
twurl -H “/1.1/media/upload.json?command=STATUS&media_id=774281214865702912"
{“request”:”/1.1/media/upload.json",“error”:“Invalid mediaId.”}

Please help!


Does a subsequent STATUS request confirm that the upload was ok?


No, it doesn’t. Every call to:
twurl -H “/1.1/media/upload.json?command=STATUS&media_id=774281214865702912”

returns the same “Invalid mediaId” error

Is there some other STATUS request I can make?

Is there an endpoint to get a list of valid mediaIds?


Hi, all. Just a quick update. We’re still investigating why we’re seeing the following error when checking the status of a media processing operation:

$ twurl -H "/1.1/media/upload.json?command=STATUS&media_id=12345" | jq
  "request": "/1.1/media/upload.json",
  "error": "Invalid mediaId."

However, it is possible to use image media in creatives. It does not seem like this is the case for video, though.

We’ll update this thread once we know more. Thanks for your patience.


Thanks @juanshishido - look forward to your update.


@SocialOpinions You must not call STATUS command if FINALIZE response doesn’t contain ‘processing_info’ field.

“If the response contains a processing_info field, then use the STATUS command to poll for the status of the FINALIZE operation.” -

Media/upload (STATUS) returns Invalid mediaId

Hi @tushar_io - I’m not calling the STATUS command though?

Also - I am still getting them same problems in that I simply cannot upload any media.

Here is a sample of my code:

RequestBuilder(oAuth, “POST”, “” + accountId +"/cards/website");

        rb.AddParameter("name", name);
        rb.AddParameter("website_title", websiteTitle);
        rb.AddParameter("website_url", websiteURL);
        rb.AddParameter("image_media_id", imageMediaId);

I have a valid media_id.


@SocialOpinions: To clarify, you’re able to successfully upload an image using the media/upload endpoint, but get the Invalid mediaId error only when trying to associate that image with a website card?


@juanshishido - Sorry it’s taken a while to get back to you on this but basically yes. I tried it out again a few days ago and still have the same issues. The first step returns the mediaId and then when I try the second step I get the error.


We’re still working to identify the issue here, @SocialOpinions. We’ll update as soon as we know more. Thanks!


@juanshishido - thanks, keep me posted!


@SocialOpinions: We’re able to create a website card without issue. Please see the steps below.

Uploading the image. Please note that: (1) “the ratio of of image width/height for website cards must be 5:2” (source) and (2) the additional_owners parameter allows you to specify the user(s), by user_id, who are allowed to use the media (source).

$ twurl -X POST -H "/1.1/media/upload.json?additional_owners={additional_owners}" --file image.jpg --file-field "media" | jq
  "media_id": 790053336116453400,
  "media_id_string": "790053336116453376",
  "size": 96203,
  "expires_after_secs": 86400,
  "image": {
    "image_type": "image/jpeg",
    "w": 900,
    "h": 360

Creating the website card.

$ twurl -X POST -H "/1/accounts/{account_id}/cards/website?name=test-website-card&website_title=test-website-title&website_url=" | jq
  "data_type": "card",
  "data": {
    "name": "test-website-card",
    "image": {image_url},
    "preview_url": {preview_url},
    "website_cta": "READ_MORE",
    "id": "1aabc",
    "account_id": {account_id},
    "created_at": "2016-10-23T00:00:01Z",
    "website_title": "test-website-title",
    "website_url": "",
    "updated_at": "2016-10-23T00:00:01Z",
    "deleted": false,
    "card_type": "WEBSITE"
  "request": {
    "params": {
      "name": "test-website-card",
      "image": {image_url},
      "account_id": {account_id},
      "website_title": "test-website-title",
      "website_url": "",
      "card_type": "WEBSITE"

If, after following these steps, there are still issues, please provide the requests you are making, using twurl.

Image for website card
Create a promotional Tweet with Website Card
Error uploading websitecard image statusCode Forbidden code 326

@SocialOpinions: Were you able to associate an image with a website card?


@juanshishido - I’ll be trying tonight, I believe my image size is ok but will triple check it all again in light of your most recent updates and feedback. Thanks for your support!


Sounds good, @SocialOpinions. Keep us posted :slight_smile: