{
  "openapi": "3.1.0",
  "info": {
    "title": "FetchLayer Reddit API — User",
    "version": "1.0.0",
    "description": "User profiles, posts, and comment history."
  },
  "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": {
    "/user-profile": {
      "post": {
        "operationId": "user-profile",
        "tags": [
          "User"
        ],
        "summary": "Karma, bio, account age, and public profile info",
        "description": "Retrieve public profile information for any Reddit user including karma breakdown, account age, and bio.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "username": {
                    "type": "string",
                    "description": "Reddit username."
                  }
                },
                "additionalProperties": false,
                "required": [
                  "username"
                ]
              },
              "examples": {
                "default": {
                  "value": {
                    "username": "spez"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "username": {
                      "type": "string",
                      "description": "Username."
                    },
                    "totalKarma": {
                      "type": "number",
                      "description": "Combined karma."
                    },
                    "postKarma": {
                      "type": "number",
                      "description": "Post karma."
                    },
                    "commentKarma": {
                      "type": "number",
                      "description": "Comment karma."
                    },
                    "accountAgeDays": {
                      "type": "number",
                      "description": "Account age in days."
                    },
                    "createdUtc": {
                      "type": "number",
                      "description": "Account creation timestamp."
                    },
                    "isGold": {
                      "type": "boolean",
                      "description": "Has Reddit Premium."
                    },
                    "isMod": {
                      "type": "boolean",
                      "description": "Is a moderator anywhere."
                    },
                    "description": {
                      "type": "string",
                      "description": "User bio/about text."
                    }
                  },
                  "additionalProperties": false
                },
                "examples": {
                  "default": {
                    "value": {
                      "username": "spez",
                      "totalKarma": 1500000,
                      "postKarma": 800000,
                      "commentKarma": 700000,
                      "accountAgeDays": 6200,
                      "createdUtc": 1150000000,
                      "isGold": true,
                      "isMod": true,
                      "description": "Reddit co-founder."
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Invalid or missing Bearer token"
          }
        },
        "security": [
          {
            "BearerAuth": []
          }
        ]
      }
    },
    "/user-posts": {
      "post": {
        "operationId": "user-posts",
        "tags": [
          "User"
        ],
        "summary": "All public posts submitted by a user",
        "description": "Retrieve the public post history for a Reddit user. Supports pagination.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "username": {
                    "type": "string",
                    "description": "Reddit username."
                  },
                  "limit": {
                    "type": "number",
                    "description": "Number of posts (max 100).",
                    "example": "25"
                  },
                  "before": {
                    "type": "string",
                    "description": "Pagination cursor (before)."
                  },
                  "after": {
                    "type": "string",
                    "description": "Pagination cursor (after)."
                  }
                },
                "additionalProperties": false,
                "required": [
                  "username"
                ]
              },
              "examples": {
                "default": {
                  "value": {
                    "username": "spez",
                    "limit": 10
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "posts": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "title": {
                            "type": "string",
                            "description": "Post title."
                          },
                          "subreddit": {
                            "type": "string",
                            "description": "Subreddit."
                          },
                          "score": {
                            "type": "number",
                            "description": "Score."
                          },
                          "numComments": {
                            "type": "number",
                            "description": "Comment count."
                          },
                          "permalink": {
                            "type": "string",
                            "description": "Relative permalink."
                          },
                          "createdUtc": {
                            "type": "number",
                            "description": "Unix timestamp."
                          }
                        },
                        "additionalProperties": false
                      }
                    },
                    "after": {
                      "type": "string",
                      "description": "Cursor for next page."
                    },
                    "before": {
                      "type": "string",
                      "description": "Cursor for previous page."
                    }
                  },
                  "additionalProperties": false
                },
                "examples": {
                  "default": {
                    "value": {
                      "posts": [
                        {
                          "title": "Announcing new features",
                          "subreddit": "reddit",
                          "score": 5000,
                          "numComments": 800,
                          "permalink": "/r/reddit/comments/abc/",
                          "createdUtc": 1718000000
                        }
                      ],
                      "after": "t3_next"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Invalid or missing Bearer token"
          }
        },
        "security": [
          {
            "BearerAuth": []
          }
        ]
      }
    },
    "/user-comments": {
      "post": {
        "operationId": "user-comments",
        "tags": [
          "User"
        ],
        "summary": "Comment history for any public user",
        "description": "Retrieve the public comment history for a Reddit user. Supports pagination.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "username": {
                    "type": "string",
                    "description": "Reddit username."
                  },
                  "limit": {
                    "type": "number",
                    "description": "Number of comments (max 100).",
                    "example": "25"
                  },
                  "before": {
                    "type": "string",
                    "description": "Pagination cursor (before)."
                  },
                  "after": {
                    "type": "string",
                    "description": "Pagination cursor (after)."
                  }
                },
                "additionalProperties": false,
                "required": [
                  "username"
                ]
              },
              "examples": {
                "default": {
                  "value": {
                    "username": "spez",
                    "limit": 10
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "comments": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "body": {
                            "type": "string",
                            "description": "Comment text."
                          },
                          "subreddit": {
                            "type": "string",
                            "description": "Subreddit."
                          },
                          "score": {
                            "type": "number",
                            "description": "Score."
                          },
                          "postTitle": {
                            "type": "string",
                            "description": "Parent post title."
                          },
                          "permalink": {
                            "type": "string",
                            "description": "Relative permalink."
                          },
                          "createdUtc": {
                            "type": "number",
                            "description": "Unix timestamp."
                          }
                        },
                        "additionalProperties": false
                      }
                    },
                    "after": {
                      "type": "string",
                      "description": "Cursor for next page."
                    }
                  },
                  "additionalProperties": false
                },
                "examples": {
                  "default": {
                    "value": {
                      "comments": [
                        {
                          "body": "Thanks for the feedback!",
                          "subreddit": "reddit",
                          "score": 250,
                          "postTitle": "Announcing new features",
                          "permalink": "/r/reddit/comments/abc/comment/xyz/",
                          "createdUtc": 1718000000
                        }
                      ],
                      "after": "t1_next"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Invalid or missing Bearer token"
          }
        },
        "security": [
          {
            "BearerAuth": []
          }
        ]
      }
    }
  }
}