{
  "openapi": "3.0.1",
  "info": {
    "title": "NYS DOCCS In-Custody Details",
    "description": "Enriches a completed NYS DOCCS Basic Snapshot dataset by keeping IN CUSTODY records and fetching per-DIN custody, sentence, parole, crime, facility, and provenance details. Requires a successful Basic Snapshot dataset as input.",
    "version": "0.4",
    "x-build-id": "xrfh0DjjskXWMIfjx"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/jippylong12~nys-doccs-in-custody-details/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-jippylong12-nys-doccs-in-custody-details",
        "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/jippylong12~nys-doccs-in-custody-details/runs": {
      "post": {
        "operationId": "runs-sync-jippylong12-nys-doccs-in-custody-details",
        "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/jippylong12~nys-doccs-in-custody-details/run-sync": {
      "post": {
        "operationId": "run-sync-jippylong12-nys-doccs-in-custody-details",
        "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",
        "required": [
          "sourceDatasetId"
        ],
        "properties": {
          "sourceDatasetId": {
            "title": "Source dataset",
            "minLength": 1,
            "type": "string",
            "description": "Required upstream basic snapshot dataset. This requests READ access so the Actor can consume a completed source dataset while still running under limited permissions."
          },
          "sourceRunId": {
            "title": "Source run ID",
            "minLength": 1,
            "type": "string",
            "description": "Optional upstream basic snapshot run ID for provenance. In production this should come from {{resource.id}} on the Actor-to-Actor integration."
          },
          "resumeMode": {
            "title": "Resume mode",
            "enum": [
              "auto",
              "forceNew"
            ],
            "type": "string",
            "description": "Auto resumes the current unfinished detail logical run for the same source dataset. Force new abandons the previous unfinished logical run and starts a fresh detail run.",
            "default": "auto"
          },
          "workerCount": {
            "title": "Worker count",
            "minimum": 1,
            "maximum": 12,
            "type": "integer",
            "description": "Number of parallel DIN detail workers. Keep this conservative because each worker uses residential proxy traffic and its own cookie-backed session.",
            "default": 4
          },
          "requestDelayMs": {
            "title": "Delay between requests per worker (ms)",
            "minimum": 0,
            "type": "integer",
            "description": "Base pacing delay applied independently inside each detail worker session before requests.",
            "default": 3000
          },
          "delayJitterMs": {
            "title": "Per-request jitter (ms)",
            "pattern": "^\\d+(\\s*-\\s*\\d+)?$",
            "type": "string",
            "description": "Optional fixed integer or min-max range added to requestDelayMs on every request. Default 250-500.",
            "default": "250-500"
          },
          "sessionRotationEveryItems": {
            "title": "Session rotation every items",
            "minimum": 1,
            "maximum": 1000,
            "type": "integer",
            "description": "Rotate each worker's residential proxy session after this many DIN detail lookups.",
            "default": 100
          },
          "checkpointEveryItems": {
            "title": "Checkpoint every items",
            "minimum": 1,
            "maximum": 1000,
            "type": "integer",
            "description": "Persist the next unprocessed item index after this many newly committed DINs, plus on clean worker boundaries.",
            "default": 25
          },
          "retainedCompletedRuns": {
            "title": "Retained completed runs",
            "minimum": 1,
            "maximum": 20,
            "type": "integer",
            "description": "How many completed named final datasets to keep after cleanup. Older retained copies are deleted automatically.",
            "default": 2
          },
          "sampleRowLimit": {
            "title": "Sample rows in OUTPUT",
            "minimum": 1,
            "maximum": 50,
            "type": "integer",
            "description": "How many sample enriched rows to include in the final OUTPUT summary record.",
            "default": 10
          }
        }
      },
      "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
                  }
                }
              },
              "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}