{
  "openapi": "3.1.0",
  "info": {
    "title": "CityPros public API",
    "version": "1.0.0",
    "summary": "Read-only public data from the CityPros website.",
    "description": "CityPros is a mobile app for professional communities, events and local connections. This API publishes the same public information as the website, as JSON: the cities CityPros is live in, the communities and upcoming events listed on each city page, and the frequently asked questions. It is read-only and needs no authentication. It never returns member profiles or any other personal data. There is no API for signing up, signing in or managing a community: those happen in the iOS and Android apps.",
    "contact": {
      "name": "CityPros",
      "email": "hello@citypros.app",
      "url": "https://www.citypros.app/developers"
    },
    "termsOfService": "https://www.citypros.app/terms"
  },
  "externalDocs": {
    "description": "Developer docs",
    "url": "https://www.citypros.app/developers"
  },
  "servers": [
    {
      "url": "https://www.citypros.app",
      "description": "Production"
    }
  ],
  "security": [],
  "tags": [
    {
      "name": "Cities",
      "description": "Cities, their communities and events."
    },
    {
      "name": "FAQ",
      "description": "Frequently asked questions."
    }
  ],
  "paths": {
    "/api/v1/cities": {
      "get": {
        "operationId": "listCities",
        "tags": [
          "Cities"
        ],
        "summary": "List the cities CityPros is live in",
        "responses": {
          "200": {
            "description": "The live cities.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/CitySummary"
                      }
                    }
                  }
                },
                "example": {
                  "data": [
                    {
                      "slug": "barcelona",
                      "name": "Barcelona",
                      "url": "https://www.citypros.app/barcelona",
                      "api_url": "https://www.citypros.app/api/v1/cities/barcelona"
                    }
                  ]
                }
              }
            }
          },
          "405": {
            "description": "The API is read-only. Use GET.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/cities/{slug}": {
      "get": {
        "operationId": "getCity",
        "tags": [
          "Cities"
        ],
        "summary": "Get one city with its communities and upcoming events",
        "description": "Returns the public communities and upcoming public events shown on the city's page. Private, cancelled and past events are never included. Data is refreshed about every ten minutes.",
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "description": "A city slug from the list of cities.",
            "schema": {
              "type": "string"
            },
            "example": "barcelona"
          }
        ],
        "responses": {
          "200": {
            "description": "The city.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/City"
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "No live city has this slug.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "405": {
            "description": "The API is read-only. Use GET.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "502": {
            "description": "The city data could not be loaded. Retry shortly.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/faqs": {
      "get": {
        "operationId": "listFaqs",
        "tags": [
          "FAQ"
        ],
        "summary": "List the frequently asked questions",
        "responses": {
          "200": {
            "description": "Questions and plain text answers, as shown on the FAQ page.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Faq"
                      }
                    }
                  }
                }
              }
            }
          },
          "405": {
            "description": "The API is read-only. Use GET.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "CitySummary": {
        "type": "object",
        "required": [
          "slug",
          "name",
          "url",
          "api_url"
        ],
        "properties": {
          "slug": {
            "type": "string",
            "examples": [
              "barcelona"
            ]
          },
          "name": {
            "type": "string",
            "examples": [
              "Barcelona"
            ]
          },
          "url": {
            "type": "string",
            "format": "uri",
            "description": "The city's page on the website."
          },
          "api_url": {
            "type": "string",
            "format": "uri",
            "description": "This city in the API."
          }
        }
      },
      "City": {
        "type": "object",
        "required": [
          "slug",
          "name",
          "url",
          "communities",
          "events"
        ],
        "properties": {
          "slug": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "url": {
            "type": "string",
            "format": "uri"
          },
          "country_code": {
            "type": [
              "string",
              "null"
            ],
            "examples": [
              "ES"
            ]
          },
          "timezone": {
            "type": [
              "string",
              "null"
            ],
            "description": "IANA time zone of the city.",
            "examples": [
              "Europe/Madrid"
            ]
          },
          "generated_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "When the underlying data was generated."
          },
          "communities": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Community"
            }
          },
          "events": {
            "type": "array",
            "description": "Upcoming public events.",
            "items": {
              "$ref": "#/components/schemas/Event"
            }
          }
        }
      },
      "Community": {
        "type": "object",
        "required": [
          "id",
          "name"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "description": {
            "type": [
              "string",
              "null"
            ]
          },
          "member_count": {
            "type": [
              "integer",
              "null"
            ]
          },
          "industries": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        }
      },
      "Event": {
        "type": "object",
        "required": [
          "id",
          "title",
          "starts_at"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "title": {
            "type": "string"
          },
          "description": {
            "type": [
              "string",
              "null"
            ]
          },
          "starts_at": {
            "type": "string",
            "format": "date-time"
          },
          "ends_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "location": {
            "type": [
              "string",
              "null"
            ]
          },
          "category": {
            "type": [
              "string",
              "null"
            ]
          },
          "host": {
            "type": [
              "string",
              "null"
            ],
            "description": "The community or source the event comes from."
          },
          "cost": {
            "type": "object",
            "required": [
              "type"
            ],
            "properties": {
              "type": {
                "type": [
                  "string",
                  "null"
                ],
                "examples": [
                  "free",
                  "paid"
                ]
              },
              "amount": {
                "type": [
                  "number",
                  "null"
                ]
              },
              "currency": {
                "type": [
                  "string",
                  "null"
                ],
                "examples": [
                  "EUR"
                ]
              }
            }
          },
          "registration_url": {
            "type": [
              "string",
              "null"
            ],
            "format": "uri"
          }
        }
      },
      "Faq": {
        "type": "object",
        "required": [
          "question",
          "answer"
        ],
        "properties": {
          "question": {
            "type": "string"
          },
          "answer": {
            "type": "string"
          }
        }
      },
      "Error": {
        "type": "object",
        "required": [
          "error"
        ],
        "properties": {
          "error": {
            "type": "object",
            "required": [
              "code",
              "status",
              "message",
              "hint",
              "docs_url"
            ],
            "properties": {
              "code": {
                "type": "string",
                "description": "A stable, machine readable error code.",
                "enum": [
                  "not_found",
                  "city_not_found",
                  "method_not_allowed",
                  "upstream_unavailable"
                ]
              },
              "status": {
                "type": "integer",
                "description": "The HTTP status code."
              },
              "message": {
                "type": "string",
                "description": "What went wrong."
              },
              "hint": {
                "type": "string",
                "description": "How to resolve it."
              },
              "docs_url": {
                "type": "string",
                "format": "uri"
              }
            }
          }
        },
        "example": {
          "error": {
            "code": "city_not_found",
            "status": 404,
            "message": "No live city has the slug \"atlantis\".",
            "hint": "List the available cities at /api/v1/cities.",
            "docs_url": "https://www.citypros.app/developers"
          }
        }
      }
    }
  }
}