{
  "openapi": "3.1.0",
  "info": {
    "title": "FetchLayer Reddit API — Utility",
    "version": "1.0.0",
    "description": "Helper endpoints for URL resolution and inspection."
  },
  "servers": [
    {
      "url": "https://api.fetchlayer.dev/reddit"
    }
  ],
  "security": [
    {
      "BearerAuth": []
    }
  ],
  "components": {
    "securitySchemes": {
      "BearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "API Key",
        "description": "Send your FetchLayer key as Authorization: Bearer ss-your-key. No Reddit OAuth credentials are required."
      }
    }
  },
  "paths": {
    "/resolve-url-type": {
      "post": {
        "operationId": "resolve-url-type",
        "tags": [
          "Utility"
        ],
        "summary": "Identify what a Reddit URL points to",
        "description": "Pass any Reddit URL and get back the resource type (post, comment, subreddit, user) and its ID. Useful for routing and validation.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "url": {
                    "type": "string",
                    "description": "Full Reddit URL."
                  }
                },
                "additionalProperties": false,
                "required": [
                  "url"
                ]
              },
              "examples": {
                "default": {
                  "value": {
                    "url": "https://www.reddit.com/r/programming/comments/abc123/"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": "string",
                      "description": "Resource type: post, comment, subreddit, user."
                    },
                    "id": {
                      "type": "string",
                      "description": "Resource ID (t3_, t1_, etc.)."
                    },
                    "slug": {
                      "type": "string",
                      "description": "URL slug."
                    }
                  },
                  "additionalProperties": false
                },
                "examples": {
                  "default": {
                    "value": {
                      "type": "post",
                      "id": "t3_abc123",
                      "slug": "programming/comments/abc123"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Invalid or missing Bearer token"
          }
        },
        "security": [
          {
            "BearerAuth": []
          }
        ]
      }
    }
  }
}