Create an article

POST /articles

Create an article. Auth is required

application/json

Body Required

Article to create

  • article object Required
    Hide article attributes Show article attributes object
    • title string Required
    • description string Required
    • body string Required
    • tags array[string]

Responses

  • 201 application/json

    OK

    Hide response attribute Show response attribute object
    • article object Required
      Hide article attributes Show article attributes object
      • slug string Required
      • title string Required
      • description string Required
      • body string Required
      • tags array[string] Required
      • createdAt string(date-time) Required
      • updatedAt string(date-time) Required
      • favorited boolean Required
      • favoritesCount integer Required
      • author object Required
        Hide author attributes Show author attributes object
        • username string Required
        • bio string Required
        • image string Required
        • following boolean Required
  • 401

    Unauthorized

  • 422 application/json

    Unexpected error

    Hide response attribute Show response attribute object
    • errors object Required
      Hide errors attribute Show errors attribute object
      • body array[string] Required
POST /articles
curl \
 --request POST '/api/articles' \
 --header "Authorization: $API_KEY" \
 --header "Content-Type: application/json" \
 --data '{"article":{"title":"string","description":"string","body":"string","tags":["string"]}}'
Request examples
{
  "article": {
    "title": "string",
    "description": "string",
    "body": "string",
    "tags": [
      "string"
    ]
  }
}
Response examples (201)
{
  "article": {
    "slug": "how-to-train-your-dragon",
    "title": "How to train your dragon",
    "description": "Ever wonder how?",
    "body": "It takes a Jacobian",
    "tags": [
      "dragons",
      "training"
    ],
    "createdAt": "2025-05-04T09:42:00Z",
    "updatedAt": "2025-05-04T09:42:00Z",
    "favorited": false,
    "favoritesCount": 42,
    "author": {
      "bio": "I work at State Farm.",
      "image": "https://api.realworld.io/images/smiley-cyrus.jpg",
      "username": "jake",
      "following": false
    }
  }
}
Response examples (422)
{
  "errors": {
    "body": [
      "string"
    ]
  }
}