monorepo/cloud/maplepress-backend/docs/API/get-site.md

2.1 KiB

Get WordPress Site

GET /api/v1/sites/{id}

Retrieve detailed information about a specific WordPress site.

Authentication: Required (JWT Bearer token)

Headers:

  • Authorization: JWT {access_token}

URL Parameters:

Parameter Type Required Description
id UUID Yes Site ID

Example Request:

curl -X GET http://localhost:8000/api/v1/sites/a1b2c3d4-e5f6-7890-abcd-ef1234567890 \
  -H "Authorization: JWT eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."

Example Response (200 OK):

{
  "id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
  "tenant_id": "t1t2t3t4-t5t6-7890-tttt-tttttttttttt",
  "domain": "example.com",
  "site_url": "https://example.com",
  "api_key_prefix": "live_sk_a1b2",
  "api_key_last_four": "s9t0",
  "status": "active",
  "is_verified": true,
  "search_index_name": "site_a1b2c3d4-e5f6-7890-abcd-ef1234567890",
  "total_pages_indexed": 145,
  "last_indexed_at": "2024-10-27T14:30:00Z",
  "plugin_version": "1.0.0",
  "storage_used_bytes": 52428800,
  "search_requests_count": 234,
  "monthly_pages_indexed": 50,
  "last_reset_at": "2024-10-01T00:00:00Z",
  "created_at": "2024-10-27T10:00:00Z",
  "updated_at": "2024-10-27T14:30:00Z"
}

Notes:

  • Returns full site details including usage tracking statistics
  • API key is never returned (only prefix and last 4 chars for identification)
  • Useful for dashboard display and usage monitoring
  • Usage-based billing: No quotas or limits, only usage tracking

Error Responses:

This endpoint returns errors in RFC 9457 (Problem Details for HTTP APIs) format.

Content-Type: application/problem+json

401 Unauthorized:

{
  "type": "about:blank",
  "title": "Unauthorized",
  "status": 401,
  "detail": "Authentication required"
}

404 Not Found:

{
  "type": "about:blank",
  "title": "Not Found",
  "status": 404,
  "detail": "Site not found or doesn't belong to your tenant"
}

500 Internal Server Error:

{
  "type": "about:blank",
  "title": "Internal Server Error",
  "status": 500,
  "detail": "Failed to retrieve site"
}