- INIT — Initialize the upload and get a
media_id - APPEND — Upload each chunk of the file
- FINALIZE — Complete the upload
- STATUS — (If needed) Wait for processing to complete
See this sample code for a complete Python example.
Step 1: Initialize upload (INIT)
Start the upload session to get amedia_id:
cURL
Step 2: Upload chunks (APPEND)
Upload each chunk of the file. For example, split a 3 MB file into 3 chunks:cURL
Chunking advantages:
- Improved reliability on slow networks
- Uploads can be paused and resumed
- Failed chunks can be retried individually
Step 3: Finalize upload (FINALIZE)
Complete the upload after all chunks are sent:cURL
If
processing_info is returned, proceed to Step 4 to wait for processing. If not, the media is ready to use.Step 4: Check status (STATUS)
Ifprocessing_info was returned, poll for processing completion:
cURL
pending → in_progress → succeeded or failed
Step 5: Create Post with media
Once processing is complete, create a Post with the media:cURL
Media categories
| Category | Description |
|---|---|
tweet_image | Image for a Post |
tweet_gif | Animated GIF for a Post |
tweet_video | Video for a Post |
amplify_video | Amplify video |