Skip to content

How to get Medium articles and their text with an API

Updated · 2 steps

Fetchproof reads a Medium author's public feed and returns their recent articles and the full text of each one as JSON, for monitoring writers, building a reading list or indexing articles for search.

01

List an author's articles

Pass the username without @. Each article has its id, title, url and published_at.

GET /v1/medium/user/posts 1 credit per call

cURL

curl --request GET 'https://api.fetchproof.com/v1/medium/user/posts?username=ev' \
  --header 'x-api-key: YOUR_API_KEY'

JavaScript

const response = await fetch("https://api.fetchproof.com/v1/medium/user/posts?username=ev", {
  method: 'GET',
  headers: {
    'x-api-key': process.env.FETCHPROOF_API_KEY,
  },
});
const data = await response.json();
console.log(data);

Python

import os
import requests

response = requests.get(
    "https://api.fetchproof.com/v1/medium/user/posts?username=ev",
    headers={"x-api-key": os.environ["FETCHPROOF_API_KEY"]},
)
print(response.json())

Go

package main

import (
  "fmt"
  "io"
  "net/http"
  "os"
)

func main() {
  req, _ := http.NewRequest("GET", "https://api.fetchproof.com/v1/medium/user/posts?username=ev", nil)
  req.Header.Set("x-api-key", os.Getenv("FETCHPROOF_API_KEY"))
  res, _ := http.DefaultClient.Do(req)
  defer res.Body.Close()
  body, _ := io.ReadAll(res.Body)
  fmt.Println(string(body))
}

PHP

<?php
$ch = curl_init("https://api.fetchproof.com/v1/medium/user/posts?username=ev");
curl_setopt_array($ch, [
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_CUSTOMREQUEST => "GET",
  CURLOPT_HTTPHEADER => [
    'x-api-key: ' . getenv('FETCHPROOF_API_KEY'),
  ],
]);
$response = curl_exec($ch);
curl_close($ch);
echo $response;
Excerpt of published sample response Full response →
{
  "success": true,
  "credits_remaining": 100,
  "credits_charged": 1,
  "username": "ev",
  "posts": [
    {
      "id": "0126fa5c6ce8",
      "title": "Making “Social” Social Again",
      "url": "https://ev.medium.com/making-social-social-again-0126fa5c6ce8",
      "published_at": "Thu, 12 Dec 2024 17:11:33 GMT"
    }
  ]
}
02

Get one article's full text

Pass the same username and the article id from the feed. The response has the title, the body as html and as plain text.

GET /v1/medium/article 1 credit per call

cURL

curl --request GET 'https://api.fetchproof.com/v1/medium/article?username=ev&id=0126fa5c6ce8' \
  --header 'x-api-key: YOUR_API_KEY'

JavaScript

const response = await fetch("https://api.fetchproof.com/v1/medium/article?username=ev&id=0126fa5c6ce8", {
  method: 'GET',
  headers: {
    'x-api-key': process.env.FETCHPROOF_API_KEY,
  },
});
const data = await response.json();
console.log(data);

Python

import os
import requests

response = requests.get(
    "https://api.fetchproof.com/v1/medium/article?username=ev&id=0126fa5c6ce8",
    headers={"x-api-key": os.environ["FETCHPROOF_API_KEY"]},
)
print(response.json())

Go

package main

import (
  "fmt"
  "io"
  "net/http"
  "os"
)

func main() {
  req, _ := http.NewRequest("GET", "https://api.fetchproof.com/v1/medium/article?username=ev&id=0126fa5c6ce8", nil)
  req.Header.Set("x-api-key", os.Getenv("FETCHPROOF_API_KEY"))
  res, _ := http.DefaultClient.Do(req)
  defer res.Body.Close()
  body, _ := io.ReadAll(res.Body)
  fmt.Println(string(body))
}

PHP

<?php
$ch = curl_init("https://api.fetchproof.com/v1/medium/article?username=ev&id=0126fa5c6ce8");
curl_setopt_array($ch, [
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_CUSTOMREQUEST => "GET",
  CURLOPT_HTTPHEADER => [
    'x-api-key: ' . getenv('FETCHPROOF_API_KEY'),
  ],
]);
$response = curl_exec($ch);
curl_close($ch);
echo $response;
Excerpt of published sample response Full response →
{
  "success": true,
  "credits_remaining": 100,
  "credits_charged": 1,
  "id": "0126fa5c6ce8",
  "title": "Making “Social” Social Again",
  "html": "<figure><img alt=\"\" src=\"https://cdn-images-1.medium.com/max/1024/1*NMXyOoeQu3L1ZAXqf8QIYw…",
  "text": "Moz i, our new (actually!) social app Announcing Mozi Ev Williams, Twitter and Medium Foun…"
}

What it costs

Each call costs 1 credit. An empty feed costs 0, and cache_max_age serves a recent cached copy for 0 credits.

Limits

Only articles still in the author's public feed are available. That's their recent articles, not the full archive. An article that has left the feed is not found.

Try it with 100 free credits

Sign up with an email address, no card. Credits never expire. Errors cost 0 credits, and each endpoint page lists exactly what it charges.