Returns a single post by its ID. Requires valid authentication token.

Authentication

All authentication strategies are supported:

  • JWT Token: Standard JWT with HS256 algorithm

  • Database Token: Custom token stored in user record

  • API Key: 40-character alphanumeric key

  • Devise Token Auth: Requires uid and client headers

Errors

Code Description
401 Unauthorized - Invalid or missing token
404 Not Found - Post does not exist

Examples

curl -X GET https://your-domain.com/api/v2/posts/123       -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."       -H "Content-Type: application/json"

Response (200):
{
  "id": 123,
  "title": "Sample Post Title",
  "content": "This is the content of the post...",
  "author_id": 456,
  "created_at": "2024-01-15T10:30:00Z",
  "updated_at": "2024-01-16T14:20:00Z"
}

Error Response (404):
{
  "error": "Not Found"
}

Params

Param name Description
id
required

ID of the post

Validations:

  • Must be a Integer

Headers

Header name Description
Authorization
required
Bearer token for authentication
uid
optional
User email (required for devise_token_auth)
client
optional
Client ID (required for devise_token_auth)