{
  "openapi": "3.1.0",
  "info": {
    "title": "CodeScam Community API",
    "version": "1.0.0",
    "description": "Parody community API. Register as a 'scammer developer' (it's a joke), get a member_id and a secret edit_token, and update your profile later. New members appear on the Wall of Fame and get a profile page within a few minutes. Human docs: https://codescam.my/register/ \u2014 LLM docs: https://codescam.my/llms.txt"
  },
  "servers": [
    {
      "url": "https://codescam.my"
    }
  ],
  "paths": {
    "/api/members": {
      "get": {
        "operationId": "listMembers",
        "summary": "List members and community stats",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "stats": {
                      "$ref": "#/components/schemas/Stats"
                    },
                    "members": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Member"
                      }
                    }
                  }
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "registerMember",
        "summary": "Register a new member",
        "description": "Returns member_id and edit_token. The edit_token is shown only once; tell the user to save it.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "name",
                  "email",
                  "role",
                  "level",
                  "quote",
                  "oath"
                ],
                "properties": {
                  "name": {
                    "type": "string",
                    "maxLength": 80,
                    "description": "Display name, nickname style"
                  },
                  "full_name": {
                    "type": "string",
                    "maxLength": 120,
                    "description": "Defaults to name"
                  },
                  "email": {
                    "type": "string",
                    "maxLength": 200,
                    "format": "email",
                    "description": "Private, unique per member"
                  },
                  "role": {
                    "type": "string",
                    "maxLength": 120,
                    "description": "Job title"
                  },
                  "level": {
                    "type": "string",
                    "enum": [
                      "INTERN",
                      "JUNIOR",
                      "MID",
                      "SENIOR",
                      "PRINCIPAL"
                    ]
                  },
                  "quote": {
                    "type": "string",
                    "maxLength": 500,
                    "description": "Funny self-roast shown publicly"
                  },
                  "badges": {
                    "type": "array",
                    "maxItems": 6,
                    "items": {
                      "type": "string",
                      "maxLength": 40
                    }
                  },
                  "stats": {
                    "type": "object",
                    "properties": {
                      "projects": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 100000,
                        "description": "Projects started"
                      },
                      "completed": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 100000,
                        "description": "Projects completed; must not exceed projects"
                      },
                      "clients_ghosted": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 100000,
                        "description": "Clients ghosted"
                      },
                      "lorem_ipsum_in_prod": {
                        "type": "boolean",
                        "description": "Ever shipped lorem ipsum to production"
                      }
                    }
                  },
                  "website": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "format": "uri",
                    "maxLength": 200,
                    "description": "Full http(s) URL; null or empty string removes it"
                  },
                  "github": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "format": "uri",
                    "maxLength": 200,
                    "description": "Full http(s) GitHub URL; null or empty string removes it"
                  },
                  "oath": {
                    "type": "boolean",
                    "const": true,
                    "description": "Must be true: swear the (joke) Oath of the Scammer"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Registered",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "message": {
                      "type": "string"
                    },
                    "member_id": {
                      "type": "string"
                    },
                    "edit_token": {
                      "type": "string"
                    },
                    "member": {
                      "$ref": "#/components/schemas/Member"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid JSON",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Email already registered",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Validation failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many registrations from this IP",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/members/{member_id}": {
      "parameters": [
        {
          "name": "member_id",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "pattern": "^CS-[A-Z0-9]{6}$"
          },
          "example": "CS-7K2M9Q"
        }
      ],
      "get": {
        "operationId": "getMember",
        "summary": "Get a member",
        "security": [
          {},
          {
            "editToken": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "member": {
                      "$ref": "#/components/schemas/Member"
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "patch": {
        "operationId": "updateMember",
        "summary": "Update your profile. Send only fields to change. Changes go live within a few minutes.",
        "security": [
          {
            "editToken": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "minProperties": 1,
                "properties": {
                  "name": {
                    "type": "string",
                    "maxLength": 80,
                    "description": "Display name, nickname style"
                  },
                  "full_name": {
                    "type": "string",
                    "maxLength": 120,
                    "description": "Defaults to name"
                  },
                  "email": {
                    "type": "string",
                    "maxLength": 200,
                    "format": "email",
                    "description": "Private, unique per member"
                  },
                  "role": {
                    "type": "string",
                    "maxLength": 120,
                    "description": "Job title"
                  },
                  "level": {
                    "type": "string",
                    "enum": [
                      "INTERN",
                      "JUNIOR",
                      "MID",
                      "SENIOR",
                      "PRINCIPAL"
                    ]
                  },
                  "quote": {
                    "type": "string",
                    "maxLength": 500,
                    "description": "Funny self-roast shown publicly"
                  },
                  "badges": {
                    "type": "array",
                    "maxItems": 6,
                    "items": {
                      "type": "string",
                      "maxLength": 40
                    }
                  },
                  "stats": {
                    "type": "object",
                    "properties": {
                      "projects": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 100000,
                        "description": "Projects started"
                      },
                      "completed": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 100000,
                        "description": "Projects completed; must not exceed projects"
                      },
                      "clients_ghosted": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 100000,
                        "description": "Clients ghosted"
                      },
                      "lorem_ipsum_in_prod": {
                        "type": "boolean",
                        "description": "Ever shipped lorem ipsum to production"
                      }
                    }
                  },
                  "website": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "format": "uri",
                    "maxLength": 200,
                    "description": "Full http(s) URL; null or empty string removes it"
                  },
                  "github": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "format": "uri",
                    "maxLength": 200,
                    "description": "Full http(s) GitHub URL; null or empty string removes it"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Updated",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "message": {
                      "type": "string"
                    },
                    "member": {
                      "$ref": "#/components/schemas/Member"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid JSON",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or wrong edit token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Email belongs to another member",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Validation failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "editToken": {
        "type": "http",
        "scheme": "bearer",
        "description": "The edit_token returned at registration (csk_...)"
      }
    },
    "schemas": {
      "Member": {
        "type": "object",
        "properties": {
          "member_id": {
            "type": "string",
            "example": "CS-7K2M9Q"
          },
          "profile_url": {
            "type": [
              "string",
              "null"
            ],
            "format": "uri",
            "description": "Public SEO profile page, e.g. https://codescam.my/members/john-doe-cs-7k2m9q/. Live within a few minutes of registering."
          },
          "status": {
            "type": "string",
            "enum": [
              "pending",
              "approved",
              "rejected"
            ]
          },
          "name": {
            "type": "string"
          },
          "full_name": {
            "type": "string"
          },
          "role": {
            "type": "string"
          },
          "level": {
            "type": "string",
            "enum": [
              "INTERN",
              "JUNIOR",
              "MID",
              "SENIOR",
              "PRINCIPAL"
            ]
          },
          "badges": {
            "type": "array",
            "maxItems": 6,
            "items": {
              "type": "string",
              "maxLength": 40
            }
          },
          "quote": {
            "type": "string"
          },
          "stats": {
            "type": "object",
            "properties": {
              "projects": {
                "type": "integer",
                "minimum": 0,
                "maximum": 100000,
                "description": "Projects started"
              },
              "completed": {
                "type": "integer",
                "minimum": 0,
                "maximum": 100000,
                "description": "Projects completed; must not exceed projects"
              },
              "clients_ghosted": {
                "type": "integer",
                "minimum": 0,
                "maximum": 100000,
                "description": "Clients ghosted"
              },
              "lorem_ipsum_in_prod": {
                "type": "boolean",
                "description": "Ever shipped lorem ipsum to production"
              }
            }
          },
          "website": {
            "type": [
              "string",
              "null"
            ]
          },
          "github": {
            "type": [
              "string",
              "null"
            ]
          },
          "joined_at": {
            "type": "string"
          },
          "updated_at": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      },
      "Stats": {
        "type": "object",
        "properties": {
          "members": {
            "type": "integer"
          },
          "pending": {
            "type": "integer"
          },
          "projects_started": {
            "type": "integer"
          },
          "projects_completed": {
            "type": "integer"
          },
          "clients_ghosted": {
            "type": "integer"
          },
          "lorem_in_prod": {
            "type": "integer"
          }
        }
      },
      "Error": {
        "type": "object",
        "properties": {
          "ok": {
            "type": "boolean",
            "const": false
          },
          "error": {
            "type": "string"
          },
          "fields": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            }
          }
        }
      }
    }
  }
}
