{
  "openapi": "3.0.1",
  "info": {
    "title": "Apify Dataset to OpenAI Vector Store Sync",
    "description": "Safely sync selected fields from any Apify Dataset to an existing OpenAI Vector Store. Preview changes before writing, use deterministic sharding and resumable manifests, verify every replacement, and detach only Actor-owned stale attachments—never delete global OpenAI Files.",
    "version": "0.1",
    "x-build-id": "voYyK58c2pRP1CGZA"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/nomad-agent~openai-vector-store-safe-sync/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-nomad-agent-openai-vector-store-safe-sync",
        "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/nomad-agent~openai-vector-store-safe-sync/runs": {
      "post": {
        "operationId": "runs-sync-nomad-agent-openai-vector-store-safe-sync",
        "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/nomad-agent~openai-vector-store-safe-sync/run-sync": {
      "post": {
        "operationId": "run-sync-nomad-agent-openai-vector-store-safe-sync",
        "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": [
          "vectorStoreId",
          "openaiApiKey",
          "fields",
          "recordKeyField",
          "syncId"
        ],
        "properties": {
          "mode": {
            "title": "Run mode",
            "enum": [
              "demo",
              "plan",
              "append",
              "sync"
            ],
            "type": "string",
            "description": "Demo makes no external calls. Plan inspects real inputs without OpenAI writes. Append retains old attachments. Safe sync detaches only the reviewed prior generation.",
            "default": "plan"
          },
          "vectorStoreId": {
            "title": "OpenAI vector store ID",
            "type": "string",
            "description": "Existing destination vector store. Demo ignores the prefilled placeholder; replace it before Plan, Append, or Sync. This Actor never creates, deletes, renames, or changes the store expiry."
          },
          "openaiApiKey": {
            "title": "OpenAI API key",
            "type": "string",
            "description": "BYOK key with permission to read the destination vector store and create/attach/detach Files. Demo ignores the placeholder; replace it before a real run. The key is never written to outputs or logs."
          },
          "datasetId": {
            "title": "Source Apify dataset",
            "type": "string",
            "description": "Required for manual Plan, Append, and Sync runs; integrations may supply it automatically. Demo does not read a dataset. The Actor requests read-only access."
          },
          "fields": {
            "title": "Fields to index",
            "minItems": 1,
            "maxItems": 32,
            "uniqueItems": true,
            "type": "array",
            "description": "Explicit allowlist of simple dot-separated dataset paths. Only these values and the record key are rendered into shard files.",
            "items": {
              "type": "string",
              "pattern": "^[A-Za-z0-9_-]+(?:\\.[A-Za-z0-9_-]+)*$",
              "minLength": 1,
              "maxLength": 128
            }
          },
          "recordKeyField": {
            "title": "Stable record-key field",
            "type": "string",
            "description": "Simple dot-separated path whose value is present, scalar, stable, and unique for every row, such as id or url."
          },
          "syncId": {
            "title": "Synchronization ID",
            "type": "string",
            "description": "Stable namespace for this dataset/configuration within the vector store. Demo ignores the placeholder; replace it for real runs. Use a new value if fields, key, or shard count changes."
          },
          "expectedPlanHash": {
            "title": "Reviewed plan hash",
            "type": "string",
            "description": "Required by Sync when old attachments will be detached. Copy the exact planHash from a reviewed Plan run; apply fails if source or destination changed."
          },
          "shardCount": {
            "title": "Hash buckets",
            "minimum": 1,
            "maximum": 256,
            "type": "integer",
            "description": "Persistent bucket count. It bounds File size and the number of Files in each complete generation. Do not change it for an existing syncId.",
            "default": 64
          },
          "maxRows": {
            "title": "Maximum source rows",
            "minimum": 1,
            "maximum": 1000000,
            "type": "integer",
            "description": "Fail without OpenAI writes if the source exceeds this count; data is never silently truncated.",
            "default": 50000
          },
          "maxProjectedBytes": {
            "title": "Maximum selected bytes",
            "minimum": 1024,
            "maximum": 512000000,
            "type": "integer",
            "description": "Fail before OpenAI writes when selected record keys and field values exceed this bound.",
            "default": 100000000
          },
          "maxShardBytes": {
            "title": "Maximum bytes per shard",
            "minimum": 1024,
            "maximum": 64000000,
            "type": "integer",
            "description": "Hard rendered-file bound applied before any OpenAI write.",
            "default": 4000000
          },
          "maxUploadShards": {
            "title": "Maximum uploaded shards",
            "minimum": 1,
            "maximum": 256,
            "type": "integer",
            "description": "Fail before OpenAI writes if a complete candidate generation would upload more buckets. Values above shardCount simply allow every bucket.",
            "default": 64
          },
          "maxDetachFiles": {
            "title": "Maximum detachments",
            "minimum": 0,
            "maximum": 256,
            "type": "integer",
            "description": "Maximum exact base-manifest attachments a sync run may detach. Raise only after reviewing a Plan result.",
            "default": 64
          },
          "fileExpiresAfterDays": {
            "title": "Uploaded File expiry (days)",
            "minimum": 1,
            "maximum": 30,
            "type": "integer",
            "description": "Optional OpenAI File expiry from creation. Leave empty unless the synchronization schedule refreshes content before expiry."
          },
          "pollIntervalMs": {
            "title": "Index polling interval (ms)",
            "minimum": 250,
            "maximum": 10000,
            "type": "integer",
            "description": "OpenAI vector-store batch polling interval.",
            "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
                  }
                }
              },
              "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}