Hey guys!
This is the "Getting Started" Guide for the Medium API (Unofficial Version), listed on the RapidAPI Platform.
This REST API helps you to quickly extract data from medium.com, without any hassle.
Using our Unofficial Medium API, you can get -
💡 Checkout our swagger documentation for the details on each endpoint!
Before getting started, you must first get your API Key to authenticate your calls. You'll need to pass it in the headers, along with the requests, to use the API smoothly.
Header -
x-rapidapi-key: [RAPIDAPI_KEY]
Wondering how to subscribe to Medium API and get your API Key? Read this step by step guide -
API's Base URL:
Endpoints: User 👥 : · GET User ID · GET User Info · GET User's Articles · GET User's Top Articles · GET User's Following · GET User's Publication Following · GET User's Followers · GET User's Interests · GET User's Lists · GET User's Publications · GET User's Books Article ✏️ : · GET Article Info · GET Article's Content · GET Article's Markdown · GET Article's HTML · GET Article's Assets · GET Article's Responses · GET Article's Fans · GET Related Articles · GET Recommended Articles Publication 📰 : · GET Publication ID · GET Publication Info · GET Publication Articles · GET Publication's Newsletter Platform 🌀 : · GET Archived Articles · GET Latest Posts · GET Top Writers · GET Recommended Feed · GET Top Feeds · GET Tag Info · GET Related Tags · GET Root Tags · GET Recommended Users · GET Recommended Lists List 📜 : · GET List Info · GET List Articles · GET List Responses Search 🔎 : · Search Articles · Search Publications · Search Users · Search Lists · Search Tags
Every Medium user has one unique hash ID associated with his/her account. Usually, we only deal with usernames that we choose while registering on Medium Platform. You can find your username in the sub-domain of your profile page URL or at the end of it. Like -
Once you get your username, like mine is nishu-jain, you can use the following endpoint to get your user_id
.
Endpoint -
GET /user/id_for/{username}
Usage -
Once you have the user_id
, you can invoke other user-related endpoints using it.
Once you've got the user_id
, you can use it to get user-related information such as -
Endpoint -
GET /user/{user_id}
If you don't have the user_id
, see the GET User ID endpoint above.
Usage -
This endpoint returns a list of articles written by a specified user,
with a maximum of 500 article_ids
per request.
If the user has published over 500 articles, use the next
attribute from the response
in subsequent API calls, as query string parameter, to retrieve additional articles.
Query Parameters (Optional) : -
next
: Use this parameter to get more results on the next page.💡 You can then use the GET Article Info endpoint to retrieve information, such as title, subtitle, author, claps, voters, tags, topics, publication, etc..., related to your desired article.
Endpoint -
GET /user/{user_id}/articles
Usage -
This endpoint returns a list of aritcle_ids
of the top 10 posts/articles on the user's profile (usually in chronological order - most recent posts), for the given user (user_id
).
This endpoint is "faster" than the GET User Articles endpoint.
💡 You can then use the GET Article Info endpoint to retrieve information on individual articles.
Endpoint -
GET /user/{user_id}/top_aritcles
Usage -
This endpoint returns a list of user_ids
of the given user's followings.
You can fetch this list and use the GET User Info endpoint to retrieve information related to the individual users.
Note: This list does not contain the
publication_ids
of the publications that the user is following. To get those, please use GET User Publication Following endpoint (/user/{user_id}/publication_following
).
Query Parameters (Optional): -
count
: To limit the number of results. (count
<= 1500)Endpoint -
GET /user/{user_id}/following
Usage—
This endpoint returns a list of Publications (publication_ids
) that the given user is following.
You can fetch this list and use the GET Publication Info endpoint to retrieve information related to individual publication.
Endpoint -
GET /user/{user_id}/publication_following
Usage—
This endpoint returns a list of user_ids
of the followers for the given user.
Note: When you get the response from the API, it will include an attribute called
next
. You can use this next attribute as query string parameter (after
) when you make your next API request (to the same endpoint). This way, you can get the followers that come after the one you're currently looking at.
You can use the GET User Info endpoint to retrieve information related to the individual users.
Query Parameters (Optional): -
count
: To limit the number of results. (count
<= 25)after
: To get the results after a particular follower's user id.Endpoint -
GET /user/{user_id}/followers
Usage -
This endpoint returns a list of tags
that the given user follows on Medium.
All tags are lowercased hyphen-separated strings. If you want to get the tag-related information such as how many people follow a certain tag, how many stories are published with it, how many writers are in that tag, etc ..., then use GET Tag Info endpoint.
Endpoint -
GET /user/{user_id}/interests
Usage—
This endpoint returns an array of list_ids
created by the user.
You can use the GET List Info endpoint to retrieve information on individual Medium Lists.
Endpoint -
GET /user/{user_id}/lists
Usage -
This endpoint returns 2 lists of publication_ids
where the given user is either an admin (creator/editor) or a contributing writer.
You can use the GET Publication Info endpoint to retrieve information on individual publications.
Endpoint -
GET /user/{user_id}/publications
Usage -
This endpoint returns a list of all the books published by the user. It includes the book's title, description, co-authors, published date, cover image and URL.
Endpoint -
GET /user/{user_id}/books
Usage -
This endpoint returns the article-related information such as
For using this endpoint, you'll need an article's unique hash ID, called article_id
.
You can find the article_id
at the end of any Medium Story's URL. Like -
Endpoint -
GET /article/{article_id}
Usage -
This endpoint returns the textual content of a Medium Article, for the given article_id
. The content is in plain text format and do not include text inside the image
captions and embeds.
You can get the
article_id
from the original Medium Article URL, as shown above in the GET Article Info endpoint.
Endpoint -
GET /article/{article_id}/content
Usage -
This endpoint returns the article content in the markdown format (.md), for the corresponding article_id
.
You can get the
article_id
from the original Medium Article URL, as shown above in the GET Article Info endpoint.
Endpoint -
GET /article/{article_id}/markdown
Usage -
This endpoint returns the article in plain HTML format (.html), for the given article_id
. This plain HTML output can be stylized as per your own custom branding.
You can get the
article_id
from the original Medium Article URL, as shown above in the GET Article Info endpoint.
Query Parameter (Optional) : -
fullpage
: Set fullpage
parameter to true
to get the full HTML page with head, body, title and meta tags. If fullpage
is set to false
or not provided, the endpoint will only return the HTML inside body tag.style_file
: This is where you tell the system about your CSS file.
You can either give the name of your CSS file or the web address (URL) where it's located.
If you include the file using this parameter, it will be applied to the HTML output using the
link
tag in the head
section. Just remember to set the fullpage
parameter
to true
for it to take effect. If you need an example CSS file, you can use this one:
https://mediumapi.com/styles/dark.cssEndpoint -
GET /article/{article_id}/html
GET /article/{article_id}/html?fullpage=true&style_file=dark.css
Usage -
If you want to explore the intricacies of the HTML structure obtained through the output of this endpoint, check out this article.
This endpoint returns a list of URLs for the assets present in the given Medium Article (article_id
).
These assets may include images, embedded YouTube videos, Github Gists, Hyperlinks (anchors),
Links to other Medium Articles, etc ...
You can get the
article_id
from the original Medium Article URL, as shown above in the GET Article Info endpoint.
Endpoint -
GET /article/{article_id}/assets
Usage -
This endpoint returns a list of responses (response_ids
, same as article_ids
) for a given article (article_id
)
Note: You can treat
response_id
pretty much same asaritcle_id
. To see the content of the response, use the Get Article's Content endpoint.
Endpoint -
GET /article/{article_id}/responses
Usage -
This endpoint returns a list of user_ids
of the people who clapped on the article.
You can use the GET User Info endpoint to retrieve information on individual users.
Endpoint -
GET /article/{article_id}/fans
Usage -
This endpoint returns a list of article_ids
of the related posts. (Length = 4)
Note: The related aritcles will belong to the same author or same publication or both. You can use the GET Article Info endpoint to retrieve information on individual articles.
Endpoint -
GET /article/{article_id}/related
Usage -
This endpoint returns a list of 10 articles (article_ids
) as recommended by the Medium, for the given article.
You can use the GET Article Info endpoint to retrieve information on individual articles.
Endpoint -
GET /article/{article_id}/recommended
Usage -
Every Medium Publication has one unique hash ID associated with it. Usually, we only deal with publication_slug
that is generated when we choose our Publication's Name. You can find your publication_slug
in the homepage URL of your publication. Like -
Once you get your publication_slug
, you can use the following endpoint to get your publication_id
.
Endpoint -
GET /publication/id_for/{publication_slug}
Usage -
This endpoint returns publication-related information such as Publication name, Tagline, Description, Tags, Followers Count, Creator, Editors, Twitter username, Instagram username, Facebook Page name, Logo, Domain, etc ... for the corresponding publication_id
.
A publication_id
is the unique hash ID associated with every Medium Publication. For example, publication_id
of TowardsDataScience is "7f60cf5620c9"
If you don't know the publication_id
, you can get it from any article published under it. Use the endpoint GET Article Info, to retrieve the publication_id
. Or, if you know the publication_slug
, use the endpoint GET Publication ID.
Endpoint -
GET /publication/{publication_id}
Usage -
This endpoint returns the list of articles_ids
of the latest 25 articles, posted recently in that publication.
You can use the GET Article Info endpoint to retrieve information on individual articles.
Query Parameter (Optional): -
from
: Use the from
query parameter to get the articles before that date and time.Endpoint -
GET /publication/{publication_id}/articles
Usage -
This endpoint returns information related to the associated newsletter for the given publication. This includes their name, description, creator's id, subscriber's count, unique id, image url, etc...
Endpoint -
GET /publication/{publication_id}/newsletter
Usage -
This endpoint returns a list of archived articles (max length = 20) for the given tag.
You can filter the results by adding optional query string parameters like year
and month
. Use the next
parameter to get more results.
Query Parameters (Optional) :
year
: Year of the archived articles (YYYY).month
: Month of the archived articles (MM).next
: Use this parameter to get more results on the next page.You can use the GET Article Info endpoint to retrieve information on individual articles.
Endpoint -
GET /archived_articles/{tag}
GET /archived_articles/{tag}?year={year}&month={month}&next={next}
Usage -
This endpoint returns a list of the latest posts (article_ids
) under a topic/niche (as classified and distributed by the Medium platform). Examples of a topic/niche can be:
These are known as topic_slugs
. (Not same as tags
)
At any given moment, this endpoint will return a list of 25 articles (article_ids
). You can then GET Article Info endpoint to retrieve information related to each article.
Endpoint -
GET /latestposts/{topic_slug}
Usage -
This endpoint returns a list of top writers (user_ids
) within a particular topic/niche (using topic_slug
). Examples of topic_slug
are -
You can use an optional query parameter count
to specify the number of top writers you want to retrieve.
Note: Maximum number of top writers within a topic will be 250.
After fetching the user_ids
, you can use the GET User Info endpoint to extract information related to the individual users.
Endpoint -
GET /top_writers/{topic_slug}
GET /top_writers/{topic_slug}?count={count}
Usage—
This endpoint returns a list of recommended articles (article_ids
)
for the given tag
. This feed is similar to Topfeeds Trending Articles.
Using the page
query string parameter, you can get the list page by page.
The page number can be between 1 and 20. Each page will have up to 25 Article IDs.
So at maximum, you can fetch 500 article_ids in 20 API calls.
Note: You can use the GET Article Info endpoint to retrieve information related to each article.
Endpoint -
GET /recommended_feed/{tag}?page={page}
Usage -
This endpoint returns a list of article_ids
(default count = 25) for the given tag
and
mode
.
Example of a tag
will 'blockchain', 'defi', 'artificial-intelligence', etc...
Mode:
hot
: For getting trending articlesnew
: For getting the latest articlestop_year
: For getting the best articles of the yeartop_month
: For getting the best articles of the monthtop_week
: For getting the best articles of the weektop_all_time
: For getting the best articles of all timeNote: You can use the GET Article Info endpoint to retrieve information related to each article.
Endpoint -
GET /topfeeds/{tag}/{mode}
Usage -
This endpoint returns tag-related information for the given tag
. This includes:
Note:
tags
are lowercased, hyphen-separated strings representing a category or niche on Medium Platform
Endpoint -
GET /tag/{tag}
Usage -
This endpoint returns a list of related_tags
for a given tag
.
Example: For the tag blockchain
, it will return "cryptocurrency", "bitcoin", "ethereum", "crypto", "ico", "technology", "defi", "nft", "fintech".
Endpoint -
GET /related_tags/{tag}
Usage -
This endpoint returns a list of root tags (or top-level tags) from the Medium Platform. This is how Medium broadly categorizes articles.
These tags have their own child tags that you can fetch using the Tag Info endpoint.
This list may change/expand in the future.
Endpoint -
GET /root_tags
Usage -
This endpoint returns a list of recommended users (who to follow) for the given tag.
Max length = 250.
You can use the GET User Info endpoint to retrieve information on individual users.
Endpoint -
GET /recommended_users/{tag}
Usage -
This endpoint returns an array of recommended Medium Lists for the given tag. Max Length = 250.
You can use the GET List Info endpoint to retrieve information on individual Medium Lists.
Endpoint -
GET /recommended_lists/{tag}
Usage -
This endpoint returns the Medium's list-related information - such as id, name, author, description, thumbnail image url, creation datetime, last modified datetime, number of articles in the list, claps, voters, and comments - for the given list_id
.
The list_id
is the unique hash ID associated with every Medium List. You can see it at the end of the URL as follows:
Here 38f9e0f9bea6
is the list_id
.
Endpoint -
GET /list/{list_id}
Usage -
This endpoint returns an array of article_ids
present in the given Medium List.
You can use the GET Article Info endpoint to retrieve information on individual articles.
Endpoint -
GET /list/{list_id}/articles
Usage -
This endpoint returns an array of response_ids
for the given Medium List.
Note: You can treat
response_id
pretty much same asaritcle_id
. To see the content of the response, use the Get Article's Content endpoint.
Endpoint -
GET /list/{list_id}/responses
Usage -
This endpoint returns a list of article_ids
that match the search query. The maximum length of this list will be 1000. If no articles are found that match the search query, then an empty list will be returned.
Query Parameter (Required): -
query
: A string parameter that specifies the search query for which the articles need to be retrieved.You can use the GET Article Info endpoint to retrieve information on individual articles.
Endpoint -
GET /search/articles?query={query}
Usage -
This endpoint returns a list of publication_ids
that match the search query. The maximum length of this list will be 1000. If no publications are found that match the search query, then an empty list will be returned.
Query Parameter (Required): -
query
: A string parameter that specifies the search query for which the publications need to be retrieved.You can use the GET Publication Info endpoint to retrieve information on individual publications.
Endpoint -
GET /search/publications?query={query}
Usage -
This endpoint returns a list of user_ids
that match the search query. The maximum length of this list will be 1000. If no users are found that match the search query, then an empty list will be returned.
Query Parameter (Required): -
query
: A string parameter that specifies the search query for which the users need to be retrieved.You can use the GET User Info endpoint to retrieve information on individual users.
Endpoint -
GET /search/users?query={query}
Usage -
This endpoint returns an array of list_ids
that match the search query. The maximum length of this array will be 1000. If no Medium Lists are found that match the search query, then an empty array will be returned.
Query Parameter (Required): -
query
: A string parameter that specifies the search query for which the Medium Lists need to be retrieved.You can use the GET List Info endpoint to retrieve information on individual Medium Lists.
Endpoint -
GET /search/lists?query={query}
Usage -
This endpoint returns a list of tags
that match the search query. The maximum length of this list will be 1000. If no tags are found that match the search query, then an empty list will be returned.
Query Parameter (Required): -
query
: A string parameter that specifies the search query for which the tags need to be retrieved.Endpoint -
GET /search/tags?query={query}
Usage -
As of now, this API consists of 42 endpoints (+1 test endpoint), all of which use the GET method. I'll try to add more endpoints in the future and improve its efficiency to provide you with the best Unofficial Medium API possible.
pip install medium-api
. Visit the following link to know more about Unofficial Medium API's Python SDK.If you've any thoughts on it, feel free to share them. I'll appreciate your feedback and try to improve it further.
My email ID: nishu@mediumapi.com
Thanks for reading and have a wonderful day!
PS: We post tutorials, videos, code snippets, and insights related to Medium and Unofficial Medium API. So be sure to follow us on: