Random Cats

Random Cats · GPT Actions

The Cat API

API for retrieving cat images with various filters

  • GET /images/searchGet Random Images
  • GET /images/{imageId}Get Image by ID
原始 API 定义
{
  "openapi": "3.0.0",
  "info": {
    "title": "The Cat API",
    "description": "API for retrieving cat images with various filters",
    "version": "1.0.0"
  },
  "servers": [
    {
      "url": "https://api.thecatapi.com/v1"
    }
  ],
  "paths": {
    "/images/search": {
      "get": {
        "operationId": "getRandomImages",
        "summary": "Get Random Images",
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "description": "Number of images to return, between 1-100",
            "required": false,
            "schema": {
              "type": "integer",
              "default": 1,
              "minimum": 1,
              "maximum": 100
            }
          },
          {
            "name": "breed_ids",
            "in": "query",
            "description": "Comma delimited string of breed IDs to filter images",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "api_key",
            "in": "query",
            "description": "API Key for authentication",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Array of Image Objects",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/ImageObject"
                  }
                }
              }
            }
          }
        }
      }
    },
    "/images/{imageId}": {
      "get": {
        "operationId": "getImageById",
        "summary": "Get Image by ID",
        "parameters": [
          {
            "name": "imageId",
            "in": "path",
            "required": true,
            "description": "Unique ID of the Image",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Image Object",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ImageObject"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "ImageObject": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "url": {
            "type": "string",
            "format": "uri"
          },
          "width": {
            "type": "integer"
          },
          "height": {
            "type": "integer"
          },
          "breeds": {
            "type": "array",
            "items": {
              "type": "object"
            }
          }
        }
      }
    }
  },
  "securitySchemes": {
    "ApiKeyAuth": {
      "type": "apiKey",
      "in": "header",
      "name": "x-api-key"
    }
  },
  "security": [
    {
      "ApiKeyAuth": []
    }
  ]
}