Last active
October 20, 2025 22:14
-
-
Save pH-7/aad78d9ae7bb51044a84f616f5aa3301 to your computer and use it in GitHub Desktop.
get-medium-publication-ids.sh - https://PierreHenry.dev
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # First, set your Medium API token (from https://medium.com/me/settings/security if you do have one) | |
| TOKEN="your-medium-token" | |
| # 1. Get user ID | |
| echo "Getting user ID..." | |
| USER_INFO=$(curl -X GET "https://api.medium.com/v1/me" \ | |
| -H "Authorization: Bearer $TOKEN" \ | |
| -H "Content-Type: application/json" \ | |
| -H "Accept: application/json" \ | |
| -H "Accept-Charset: utf-8") | |
| # Extract user ID using jq (if installed) | |
| USER_ID=$(echo $USER_INFO | jq -r '.data.id') | |
| echo "User ID: $USER_ID" | |
| # 2. Get user's publications | |
| echo "Getting publications..." | |
| curl -X GET "https://api.medium.com/v1/users/$USER_ID/publications" \ | |
| -H "Authorization: Bearer $TOKEN" \ | |
| -H "Content-Type: application/json" \ | |
| -H "Accept: application/json" \ | |
| -H "Accept-Charset: utf-8" |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
What you need to do is to replace
your-medium-tokenby your Medium API token. You can find yours at "Integration tokens" in Settings -> Security and apps