{
  "openapi": "3.1.0",
  "info": {
    "title": "Random User API",
    "version": "1.0",
    "description": "Generate realistic-looking people — names, emails, phones, dates of birth, cities — for the US, UK, Germany, Türkiye and India. The same seed always returns the same records, so fixtures are reproducible."
  },
  "servers": [
    {
      "url": "https://funapi.dev/api/people/v1"
    }
  ],
  "tags": [
    {
      "name": "people",
      "description": "generated people"
    }
  ],
  "paths": {
    "/users": {
      "get": {
        "tags": [
          "people"
        ],
        "summary": "Seeded random people — the same seed always returns the same records",
        "operationId": "pp-users",
        "responses": {
          "200": {
            "description": "People",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "info": {
                      "type": "object",
                      "properties": {
                        "seed": {
                          "type": "string"
                        },
                        "results": {
                          "type": "number"
                        },
                        "page": {
                          "type": "number"
                        }
                      }
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "gender": {
                            "type": "string"
                          },
                          "name": {
                            "type": "object",
                            "properties": {
                              "first": {
                                "type": "string"
                              },
                              "last": {
                                "type": "string"
                              }
                            }
                          },
                          "nat": {
                            "type": "string"
                          },
                          "email": {
                            "type": "string"
                          },
                          "phone": {
                            "type": "string"
                          },
                          "dob": {
                            "type": "string"
                          },
                          "address": {
                            "type": "object",
                            "properties": {
                              "city": {
                                "type": "string"
                              },
                              "country": {
                                "type": "string"
                              }
                            }
                          },
                          "username": {
                            "type": "string"
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameter",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Global rate limit exceeded (300 requests a minute per IP) — wait for Retry-After",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "results",
            "in": "query",
            "required": false,
            "description": "1–100, default 5",
            "schema": {
              "type": "integer",
              "format": "int32"
            },
            "example": 5
          },
          {
            "name": "seed",
            "in": "query",
            "required": false,
            "description": "Any string; omitted → random, echoed back so you can repeat it",
            "schema": {
              "type": "string"
            },
            "example": "qa-run-1"
          },
          {
            "name": "nat",
            "in": "query",
            "required": false,
            "description": "Comma-separated: us, gb, de, tr, in",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "gender",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "page",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ]
      }
    },
    "/nationalities": {
      "get": {
        "tags": [
          "people"
        ],
        "summary": "Supported nationalities",
        "operationId": "pp-nats",
        "responses": {
          "200": {
            "description": "Nationalities",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    }
                  }
                }
              }
            }
          },
          "429": {
            "description": "Global rate limit exceeded (300 requests a minute per IP) — wait for Retry-After",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "bearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "JWT",
        "description": "Use qa-admin-token / qa-viewer-token, or a JWT from POST /auth/v1/login."
      },
      "apiKeyAuth": {
        "type": "apiKey",
        "in": "header",
        "name": "X-API-Key",
        "description": "Cargo demo key: cargo-key-123."
      }
    },
    "schemas": {
      "Error": {
        "type": "object",
        "required": [
          "error",
          "message"
        ],
        "properties": {
          "error": {
            "type": "string"
          },
          "message": {
            "type": "string"
          },
          "requestId": {
            "type": "string"
          }
        },
        "additionalProperties": true
      }
    }
  }
}
