{
  "openapi": "3.0.1",
  "info": {
    "title": "Object Counter: Detect & Count Objects in Any Image",
    "description": "Detect and count people, vehicles, boats, animals and 80 everyday objects in photos, drone shots and large images. Returns counts, bounding boxes and annotated previews, with tiled inference for small objects. Pay per image.",
    "version": "1.0",
    "x-build-id": "CR4bYnueRMaNa0GG7"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/nookforgestudio~object-counter/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-nookforgestudio-object-counter",
        "x-openai-isConsequential": false,
        "summary": "Executes an Actor, waits for its completion, and returns Actor's dataset items in response.",
        "tags": [
          "Run Actor"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/inputSchema"
              }
            }
          }
        },
        "parameters": [
          {
            "name": "token",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Enter your Apify token here"
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/acts/nookforgestudio~object-counter/runs": {
      "post": {
        "operationId": "runs-sync-nookforgestudio-object-counter",
        "x-openai-isConsequential": false,
        "summary": "Executes an Actor and returns information about the initiated run in response.",
        "tags": [
          "Run Actor"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/inputSchema"
              }
            }
          }
        },
        "parameters": [
          {
            "name": "token",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Enter your Apify token here"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/runsResponseSchema"
                }
              }
            }
          }
        }
      }
    },
    "/acts/nookforgestudio~object-counter/run-sync": {
      "post": {
        "operationId": "run-sync-nookforgestudio-object-counter",
        "x-openai-isConsequential": false,
        "summary": "Executes an Actor, waits for completion, and returns the OUTPUT from Key-value store in response.",
        "tags": [
          "Run Actor"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/inputSchema"
              }
            }
          }
        },
        "parameters": [
          {
            "name": "token",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Enter your Apify token here"
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "inputSchema": {
        "type": "object",
        "properties": {
          "urls": {
            "title": "Image URLs",
            "type": "array",
            "description": "Direct links to images (JPG, PNG, WebP, TIFF, BMP).",
            "items": {
              "type": "string"
            }
          },
          "classes": {
            "title": "Objects to count",
            "type": "array",
            "description": "Leave empty to count everything. Examples: person, car, truck, bus, boat, bicycle, motorcycle, dog, bird, cow, sheep, chair, bottle. Plurals like 'cars' work.",
            "items": {
              "type": "string"
            }
          },
          "datasetId": {
            "title": "Read image URLs from a dataset",
            "type": "string",
            "description": "Optional. ID of an Apify dataset (e.g. scraper output) that contains image URLs."
          },
          "urlField": {
            "title": "URL field in dataset",
            "type": "string",
            "description": "Dot path to the field with image URL(s), e.g. 'imageUrl' or 'images'. Arrays are expanded.",
            "default": "url"
          },
          "tiling": {
            "title": "Small-object mode (tiling)",
            "enum": [
              "auto",
              "always",
              "never"
            ],
            "type": "string",
            "description": "'auto' slices images larger than about 1000 px into overlapping tiles so small objects are found. 'always' forces it, 'never' runs one pass only (cheapest).",
            "default": "auto"
          },
          "minScore": {
            "title": "Minimum confidence",
            "type": "string",
            "description": "Detections below this confidence (0 to 1) are ignored. Lower finds more objects and more false positives.",
            "default": "0.35"
          },
          "saveAnnotatedImages": {
            "title": "Save annotated previews",
            "type": "boolean",
            "description": "Store a JPEG with boxes drawn and return its URL.",
            "default": true
          },
          "includeDetections": {
            "title": "Include every box",
            "type": "boolean",
            "description": "Return each detection with label, confidence and [x0, y0, x1, y1] in original image pixels.",
            "default": true
          },
          "tileSize": {
            "title": "Tile size (px)",
            "minimum": 320,
            "maximum": 1600,
            "type": "integer",
            "description": "Tile edge in image pixels. Smaller tiles find smaller objects but cost more tiles.",
            "default": 640
          },
          "tileOverlap": {
            "title": "Tile overlap",
            "type": "string",
            "description": "Fraction of overlap between tiles (0 to 0.5).",
            "default": "0.2"
          },
          "maxTilesPerImage": {
            "title": "Max tiles per image",
            "minimum": 1,
            "maximum": 400,
            "type": "integer",
            "description": "Caps cost per image. If an image needs more tiles, tiles are enlarged to fit.",
            "default": 64
          },
          "maxImageSide": {
            "title": "Max image side (px)",
            "minimum": 640,
            "maximum": 12000,
            "type": "integer",
            "description": "Larger images are downscaled to this long-side length first.",
            "default": 8000
          },
          "maxFiles": {
            "title": "Max images",
            "minimum": 1,
            "maximum": 100000,
            "type": "integer",
            "description": "Safety cap on images per run.",
            "default": 1000
          }
        }
      },
      "runsResponseSchema": {
        "type": "object",
        "properties": {
          "data": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "actId": {
                "type": "string"
              },
              "userId": {
                "type": "string"
              },
              "startedAt": {
                "type": "string",
                "format": "date-time",
                "example": "2025-01-08T00:00:00.000Z"
              },
              "finishedAt": {
                "type": "string",
                "format": "date-time",
                "example": "2025-01-08T00:00:00.000Z"
              },
              "status": {
                "type": "string",
                "example": "READY"
              },
              "meta": {
                "type": "object",
                "properties": {
                  "origin": {
                    "type": "string",
                    "example": "API"
                  },
                  "userAgent": {
                    "type": "string"
                  }
                }
              },
              "stats": {
                "type": "object",
                "properties": {
                  "inputBodyLen": {
                    "type": "integer",
                    "example": 2000
                  },
                  "rebootCount": {
                    "type": "integer",
                    "example": 0
                  },
                  "restartCount": {
                    "type": "integer",
                    "example": 0
                  },
                  "resurrectCount": {
                    "type": "integer",
                    "example": 0
                  },
                  "computeUnits": {
                    "type": "integer",
                    "example": 0
                  }
                }
              },
              "options": {
                "type": "object",
                "properties": {
                  "build": {
                    "type": "string",
                    "example": "latest"
                  },
                  "timeoutSecs": {
                    "type": "integer",
                    "example": 300
                  },
                  "memoryMbytes": {
                    "type": "integer",
                    "example": 1024
                  },
                  "diskMbytes": {
                    "type": "integer",
                    "example": 2048
                  }
                }
              },
              "buildId": {
                "type": "string"
              },
              "defaultKeyValueStoreId": {
                "type": "string"
              },
              "defaultDatasetId": {
                "type": "string"
              },
              "defaultRequestQueueId": {
                "type": "string"
              },
              "buildNumber": {
                "type": "string",
                "example": "1.0.0"
              },
              "containerUrl": {
                "type": "string"
              },
              "usage": {
                "type": "object",
                "properties": {
                  "ACTOR_COMPUTE_UNITS": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATASET_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATASET_WRITES": {
                    "type": "integer",
                    "example": 0
                  },
                  "KEY_VALUE_STORE_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "KEY_VALUE_STORE_WRITES": {
                    "type": "integer",
                    "example": 1
                  },
                  "KEY_VALUE_STORE_LISTS": {
                    "type": "integer",
                    "example": 0
                  },
                  "REQUEST_QUEUE_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "REQUEST_QUEUE_WRITES": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATA_TRANSFER_INTERNAL_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATA_TRANSFER_EXTERNAL_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_SERPS": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_UNBLOCKER_UNITS": {
                    "type": "integer",
                    "example": 0
                  }
                }
              },
              "usageTotalUsd": {
                "type": "number",
                "example": 0.00005
              },
              "usageUsd": {
                "type": "object",
                "properties": {
                  "ACTOR_COMPUTE_UNITS": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATASET_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATASET_WRITES": {
                    "type": "integer",
                    "example": 0
                  },
                  "KEY_VALUE_STORE_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "KEY_VALUE_STORE_WRITES": {
                    "type": "number",
                    "example": 0.00005
                  },
                  "KEY_VALUE_STORE_LISTS": {
                    "type": "integer",
                    "example": 0
                  },
                  "REQUEST_QUEUE_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "REQUEST_QUEUE_WRITES": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATA_TRANSFER_INTERNAL_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATA_TRANSFER_EXTERNAL_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_SERPS": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_UNBLOCKER_UNITS": {
                    "type": "integer",
                    "example": 0
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}