DEV API (beta) (0.7.0)

Download OpenAPI specification:Download

Access Forem articles, users and other resources via API.

For a real-world example of Forem in action, check out DEV.

All endpoints that don't require authentication are CORS enabled.

Dates and date times, unless otherwise specified, must be in the RFC 3339 format.

Authentication

api_key

API Key authentication.

Authentication for some endpoints, like write operations on the Articles API require a DEV API key.

Getting an API key

To obtain one, please follow these steps:

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

  • in the "DEV API Keys" section create a new key by adding a description and clicking on "Generate API Key"

    obtain a DEV API Key

  • You'll see the newly generated key in the same view generated DEV API Key

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

      Articles are all the posts users create on DEV

      Published 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.

      It supports pagination, each page will contain 30 articles by default.

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

      Pagination page.

      per_page
      integer <int32> [ 1 .. 1000 ]
      Default: 30

      Page size (the number of items to return per page).

      tag
      string
      Example: tag=discuss

      Using this parameter will retrieve articles that contain the requested tag.

      Articles will be ordered by descending popularity.

      This parameter can be used in conjuction with top.

      username
      string
      Example: username=ben

      Using this parameter will retrieve articles belonging to a User or Organization ordered by descending publication date.

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

      This parameter can be used in conjuction with state.

      state
      string
      Enum: "fresh" "rising" "all"
      Example: state=fresh

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

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

      This param can be used in conjuction with username, only if set to all.

      top
      integer <int32> >= 1
      Example: top=2

      Using this parameter 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 be used in conjuction with tag.

      collection_id
      integer <int32>
      Example: collection_id=99

      Adding this will allow the client to return the list of articles belonging to the requested collection, ordered by ascending publication date.

      Responses

      Request samples

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

      Response samples

      Content type
      application/json
      []

      Create a new article

      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 requests per 30 seconds.

      Additional resources

      Authorizations:
      Request Body schema: application/json

      Article to create

      object

      Responses

      Request samples

      Content type
      application/json
      Example
      {
      • "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
      {