DEV API (0.5.1)

Download OpenAPI specification:Download

Access DEV articles, comments and other resources via API

Authentication

api_key

API Key authentication.

Authentication for some endpoints, like write operations on the Articles API require an API key (DEV API access token).

Getting an API key

To obtain one, please follow these steps:

  • visit https://dev.to/settings/account

  • in the "DEV API Access Tokens" section create a new token by adding a description and clicking on "Generate Token"

    obtain a DEV API access token

  • You'll see the newly generated token in the same view generated DEV API access token

Security scheme type: API Key
Header parameter name: api-key

oauth2

OAuth2 authentication.

OAuth2 authentication is still in private alpha.

Security scheme type: OAuth2
authorizationCode OAuth Flow
Authorization URL: https://dev.to/oauth/authorize
Token URL: https://dev.to/oauth/token
Refresh URL: https://dev.to/oauth/token
Scopes:
    clientCredentials OAuth Flow
    Token URL: https://dev.to/oauth/token
    Refresh URL: https://dev.to/oauth/token
    Scopes:

      articles

      Published articles

      get /articles

      Production server

      https://dev.to/api/articles

      This endpoint allows the client to retrieve a list of articles.

      "Articles" are all the posts that users create on DEV that typically show up in the feed. They can be a blog post, a discussion question, a help thread etc. but is referred to as article within the code.

      By default it will return featured, published articles ordered by descending popularity.

      Each page will contain 30 articles.

      Responses, according to the combination of params, are cached for 24 hours.

      query Parameters
      page
      integer <int32>
      Example: page=1

      Pagination page.

      This param can be used in conjuction with all other params (except when asking for fresh and rising articles by themselves).

      tag
      string
      Example: tag=discuss

      Adding this parameter will return articles that contain the requested tag.

      This param can be used by itself, with page or with top.

      username
      string
      Example: username=ben

      Adding this parameter will return articles belonging to a User or Organization ordered by descending published_at.

      If state=all the number of items returned will be 1000 instead of the default 30.

      This param can be used by itself or only with page and state.

      state
      string
      Example: state=ben

      Adding this will allow the client to check which articles are fresh or rising.

      If state=fresh the server will return published fresh articles. If state=rising the server will return published rising articles.

      This param can only be used by itself or with username if set to all.

      top
      integer <int32>
      Example: top=2

      Adding this will allow the client to return the most popular articles in the last N days.

      top indicates the number of days since publication of the articles returned.

      This param can only be used by itself or with tag.

      Responses

      200

      A list of articles

      Request samples

      Copy
      curl https://dev.to/api/articles
      

      Response samples

      Content type
      application/json
      Copy
      Expand all Collapse all
      []

      Create a new article

      post /articles

      Production server

      https://dev.to/api/articles

      This endpoint allows the client to create a new article.

      "Articles" are all the posts that users create on DEV that typically show up in the feed. They can be a blog post, a discussion question, a help thread etc. but is referred to as article within the code.

      Rate limiting

      There is a limit of 10 articles created each 30 seconds by the same user.

      Additional resources

      Authorizations:
      Request Body schema: application/json

      Article to create

      article
      object

      Responses

      201

      A newly created article

      401

      Unauthorized

      Request samples

      Content type
      application/json
      Example
      Copy
      Expand all Collapse all
      {
      • "article":
        {
        • "title": "Hello, World!",
        • "published": true,
        • "body_markdown": "Hello DEV, this is my first post",
        • "tags": "discuss, help",
        • "series": "Hello series",
        }
      }

      Response samples

      Content type
      application/json
      Copy
      Expand all Collapse all
      {}

      A published article

      get /articles/{id}

      Production server

      https://dev.to/api/articles/{id}

      This endpoint allows the client to retrieve a single published article given its id.

      Responses are cached for 5 minutes.

      path Parameters
      id
      required
      integer <int32>
      Example: 150589

      Id of the article

      Responses

      200

      An article

      404

      Resource not found

      Request samples

      Copy
      curl https://dev.to/api/articles/150589
      

      Response samples

      Content type
      application/json
      Copy
      Expand all Collapse all
      {}

      Update an existing article

      put /articles/{id}

      Production server

      https://dev.to/api/articles/{id}

      This endpoint allows the client to updated an existing article.

      "Articles" are all the posts that users create on DEV that typically show up in the feed. They can be a blog post, a discussion question, a help thread etc. but is referred to as article within the code.

      Rate limiting

      There are no limits on the amount of updates.

      Additional resources

      Authorizations:
      path Parameters
      id
      required
      integer <int32>
      Example: 150589

      Id of the article

      Request Body schema: application/json

      Article params to update.

      Note: if the article contains a front matter in its body, its front matter properties will still take precedence over any JSON equivalent params, which means that the full body_markdown with the modified front matter params needs to be provided for an update to be successful

      article
      object

      Responses

      200

      The updated article

      401

      Unauthorized

      Request samples

      Content type
      application/json
      Example
      Copy
      Expand all Collapse all
      {
      • "article":
        {
        • "title": "Hello, World!",
        • "published": true,
        • "body_markdown": "Hello DEV, this is my first post",
        • "tags": "discuss, help",
        • "series": "Hello series",
        }
      }

      Response samples

      Content type
      application/json
      Copy
      Expand all Collapse all
      {}

      Authenticated user's articles

      get /articles/me

      Production server

      https://dev.to/api/articles/me

      This endpoint allows the client to retrieve a list of its articles.

      "Articles" are all the posts that users create on DEV that typically show up in the feed. They can be a blog post, a discussion question, a help thread etc. but is referred to as article within the code.

      It will return both published and draft articles with pagination. Draft articles will be at the top of the list in reverse chronological creation order. Published articles will follow in reverse chronological publication order.

      By default a page will contain 30 articles.

      Authorizations:
      query Parameters
      page
      integer <int32>
      Example: page=1

      Pagination page.

      per_page
      integer <int32>
      Example: per_page=30

      Page size (defaults to 30 with a maximum of 1000).

      Responses

      200

      A list of articles

      Request samples

      Copy
      curl https://dev.to/api/articles/me
      

      Response samples

      Content type
      application/json
      Copy
      Expand all Collapse all
      [
      • {
        • "type_of": "string",
        • "id": 0,
        • "title": "string",
        • "description": "string",
        • "cover_image": "string",
        • "published": true,
        • "published_at": "2019-08-24T20:25:06Z",
        • "tag_list":
          [
          • "string"
          ],
        • "slug": "string",
        • "path": "string",
        • "url": "string",
        • "canonical_url": "string",
        • "comments_count": 0,
        • "positive_reactions_count": 0,
        • "published_timestamp": "2019-08-24T20:25:06Z",
        • "user":
          {
          • "name": "string",
          • "username": "string",
          • "twitter_username": "string",
          • "github_username": "string",
          • "website_url": "string",
          • "profile_image": "string",
          • "profile_image_90": "string"
          },
        • "organization":
          {
          • "name": "string",
          • "username": "string",
          • "slug": "string",
          • "profile_image": "string",
          • "profile_image_90": "string"
          },
        • "flare_tag":
          {
          • "name": "string",
          • "bg_color_hex": "string",
          • "text_color_hex": "string"
          }
        }
      ]