{
  "openapi": "3.1.0",
  "info": {
    "title": "RenewSell API",
    "version": "1.0.0",
    "description": "Targets (lists of companies or people that match criteria), their items, searches and enrichments, plus monitors, imports, webhooks, events and account helpers. Authenticate with an API key.\n"
  },
  "servers": [
    {
      "url": "https://www.renewsell.com"
    }
  ],
  "security": [
    {
      "bearer": []
    },
    {
      "apiKey": []
    }
  ],
  "paths": {
    "/v1/targets": {
      "get": {
        "operationId": "targets-list",
        "summary": "List Targets",
        "parameters": [
          {
            "$ref": "#/components/parameters/cursor"
          },
          {
            "$ref": "#/components/parameters/limit"
          }
        ],
        "responses": {
          "200": {
            "$ref": "#/components/responses/TargetList"
          }
        }
      },
      "post": {
        "operationId": "targets-create",
        "summary": "Create a Target",
        "description": "`start` defaults to true: the first Search is queued and runs. Pass `start: false` to create a draft Target (status `draft`) and start it later with `POST /v1/targets/{target}/start`.\n",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateTarget"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Target"
                }
              }
            }
          }
        }
      }
    },
    "/v1/targets/{target}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/target"
        }
      ],
      "get": {
        "operationId": "targets-get",
        "summary": "Get a Target (`?expand=items` embeds the first 100 items)",
        "responses": {
          "200": {
            "$ref": "#/components/responses/Target"
          }
        }
      },
      "patch": {
        "operationId": "targets-update",
        "summary": "Replace Target metadata",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "metadata": {
                    "$ref": "#/components/schemas/Metadata"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "$ref": "#/components/responses/Target"
          }
        }
      },
      "delete": {
        "operationId": "targets-delete",
        "summary": "Delete a Target and everything it owns",
        "responses": {
          "200": {
            "$ref": "#/components/responses/Target"
          }
        }
      }
    },
    "/v1/targets/{target}/start": {
      "parameters": [
        {
          "$ref": "#/components/parameters/target"
        }
      ],
      "post": {
        "operationId": "targets-start",
        "summary": "Start a draft Target",
        "description": "Optional body `{ criteria?, count? }`. Without `criteria` the draft's criteria are used (drafted from the query when it has none).\n",
        "responses": {
          "200": {
            "$ref": "#/components/responses/Target"
          },
          "402": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/v1/targets/{target}/cancel": {
      "parameters": [
        {
          "$ref": "#/components/parameters/target"
        }
      ],
      "post": {
        "operationId": "targets-cancel",
        "summary": "Cancel the active Search",
        "responses": {
          "200": {
            "$ref": "#/components/responses/Target"
          }
        }
      }
    },
    "/v1/targets/{target}/expand": {
      "parameters": [
        {
          "$ref": "#/components/parameters/target"
        }
      ],
      "post": {
        "operationId": "targets-expand",
        "summary": "Raise the desired item count",
        "description": "`count` is the new absolute count, not a delta.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "count"
                ],
                "properties": {
                  "count": {
                    "type": "integer",
                    "minimum": 1
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Expansion outcome with the credit estimate",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        }
      }
    },
    "/v1/targets/{target}/sourcing": {
      "parameters": [
        {
          "$ref": "#/components/parameters/target"
        }
      ],
      "get": {
        "operationId": "targets-sourcing-get",
        "summary": "Read the sourcing profile and channel catalogue",
        "responses": {
          "200": {
            "description": "Sourcing view",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        }
      },
      "patch": {
        "operationId": "targets-sourcing-update",
        "summary": "Save the sourcing profile (`{ profile, expectedVersion }`)",
        "responses": {
          "200": {
            "description": "Saved view",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        }
      }
    },
    "/v1/targets/{target}/items": {
      "parameters": [
        {
          "$ref": "#/components/parameters/target"
        }
      ],
      "get": {
        "operationId": "items-list",
        "summary": "List Items",
        "parameters": [
          {
            "$ref": "#/components/parameters/cursor"
          },
          {
            "$ref": "#/components/parameters/limit"
          },
          {
            "name": "searchId",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "Only items admitted by this Search"
          }
        ],
        "responses": {
          "200": {
            "$ref": "#/components/responses/ItemList"
          }
        }
      }
    },
    "/v1/targets/{target}/items/{id}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/target"
        },
        {
          "$ref": "#/components/parameters/id"
        }
      ],
      "get": {
        "operationId": "items-get",
        "summary": "Get an Item",
        "responses": {
          "200": {
            "description": "Item",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Item"
                }
              }
            }
          }
        }
      },
      "delete": {
        "operationId": "items-delete",
        "summary": "Remove an Item",
        "responses": {
          "200": {
            "description": "Removed Item",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Item"
                }
              }
            }
          }
        }
      }
    },
    "/v1/targets/{target}/items/{item}/enrichments/{enrichment}/retry": {
      "parameters": [
        {
          "$ref": "#/components/parameters/target"
        },
        {
          "name": "item",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          }
        },
        {
          "name": "enrichment",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          }
        }
      ],
      "post": {
        "operationId": "items-enrichment-retry",
        "summary": "Re-run one Enrichment for one Item",
        "responses": {
          "202": {
            "description": "Task scheduled",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "taskId": {
                      "type": "string"
                    },
                    "taskVersion": {
                      "type": "integer"
                    }
                  }
                }
              }
            }
          },
          "409": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/v1/targets/{target}/searches": {
      "parameters": [
        {
          "$ref": "#/components/parameters/target"
        }
      ],
      "post": {
        "operationId": "searches-create",
        "summary": "Add a Search (`behavior`: `override` or `append`)",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateSearch"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Search",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Search"
                }
              }
            }
          }
        }
      }
    },
    "/v1/targets/{target}/searches/{id}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/target"
        },
        {
          "$ref": "#/components/parameters/id"
        }
      ],
      "get": {
        "operationId": "searches-get",
        "summary": "Get a Search",
        "responses": {
          "200": {
            "description": "Search",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Search"
                }
              }
            }
          }
        }
      }
    },
    "/v1/targets/{target}/searches/{id}/cancel": {
      "parameters": [
        {
          "$ref": "#/components/parameters/target"
        },
        {
          "$ref": "#/components/parameters/id"
        }
      ],
      "post": {
        "operationId": "searches-cancel",
        "summary": "Cancel a Search",
        "responses": {
          "200": {
            "description": "Search",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Search"
                }
              }
            }
          }
        }
      }
    },
    "/v1/targets/{target}/enrichments": {
      "parameters": [
        {
          "$ref": "#/components/parameters/target"
        }
      ],
      "post": {
        "operationId": "enrichments-create",
        "summary": "Add an Enrichment column",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/EnrichmentInput"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Enrichment",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Enrichment"
                }
              }
            }
          }
        }
      }
    },
    "/v1/targets/{target}/enrichments/{id}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/target"
        },
        {
          "$ref": "#/components/parameters/id"
        }
      ],
      "get": {
        "operationId": "enrichments-get",
        "summary": "Get an Enrichment",
        "responses": {
          "200": {
            "description": "Enrichment",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Enrichment"
                }
              }
            }
          }
        }
      },
      "patch": {
        "operationId": "enrichments-update",
        "summary": "Change an Enrichment (creates a new version and re-runs it)",
        "responses": {
          "200": {
            "description": "Enrichment",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Enrichment"
                }
              }
            }
          }
        }
      },
      "delete": {
        "operationId": "enrichments-delete",
        "summary": "Delete an Enrichment",
        "responses": {
          "200": {
            "description": "Enrichment",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Enrichment"
                }
              }
            }
          }
        }
      }
    },
    "/v1/targets/{target}/enrichments/{id}/cancel": {
      "parameters": [
        {
          "$ref": "#/components/parameters/target"
        },
        {
          "$ref": "#/components/parameters/id"
        }
      ],
      "post": {
        "operationId": "enrichments-cancel",
        "summary": "Cancel pending work for an Enrichment",
        "responses": {
          "200": {
            "description": "Enrichment",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Enrichment"
                }
              }
            }
          }
        }
      }
    },
    "/v1/targets/{target}/enrichments/{id}/retry": {
      "parameters": [
        {
          "$ref": "#/components/parameters/target"
        },
        {
          "$ref": "#/components/parameters/id"
        }
      ],
      "post": {
        "operationId": "enrichments-retry",
        "summary": "Retry the failed or empty cells of one column",
        "responses": {
          "202": {
            "description": "Count retried",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "retried": {
                      "type": "integer"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/v1/events": {
      "get": {
        "operationId": "events-list",
        "summary": "List events (newest first)",
        "parameters": [
          {
            "$ref": "#/components/parameters/cursor"
          },
          {
            "$ref": "#/components/parameters/limitExtended"
          },
          {
            "name": "types",
            "in": "query",
            "schema": {
              "type": "array",
              "items": {
                "$ref": "#/components/schemas/EventType"
              }
            },
            "style": "form",
            "explode": true
          },
          {
            "name": "createdAfter",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "createdBefore",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Events",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EventList"
                }
              }
            }
          }
        }
      }
    },
    "/v1/events/{id}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/id"
        }
      ],
      "get": {
        "operationId": "events-get",
        "summary": "Get an event",
        "responses": {
          "200": {
            "description": "Event",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Event"
                }
              }
            }
          }
        }
      }
    },
    "/v1/webhooks": {
      "get": {
        "parameters": [
          {
            "$ref": "#/components/parameters/cursor"
          },
          {
            "$ref": "#/components/parameters/limitExtended"
          }
        ],
        "operationId": "webhooks-list",
        "summary": "List webhooks",
        "responses": {
          "200": {
            "$ref": "#/components/responses/GenericList"
          }
        }
      },
      "post": {
        "operationId": "webhooks-create",
        "summary": "Create a webhook (the signing secret is returned once)",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateWebhook"
              }
            }
          }
        },
        "responses": {
          "200": {
            "$ref": "#/components/responses/Object"
          }
        }
      }
    },
    "/v1/webhooks/{id}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/id"
        }
      ],
      "get": {
        "operationId": "webhooks-get",
        "summary": "Get a webhook",
        "responses": {
          "200": {
            "$ref": "#/components/responses/Object"
          }
        }
      },
      "patch": {
        "operationId": "webhooks-update",
        "summary": "Update a webhook",
        "responses": {
          "200": {
            "$ref": "#/components/responses/Object"
          }
        }
      },
      "delete": {
        "operationId": "webhooks-delete",
        "summary": "Delete a webhook",
        "responses": {
          "200": {
            "$ref": "#/components/responses/Object"
          }
        }
      }
    },
    "/v1/webhooks/{id}/attempts": {
      "parameters": [
        {
          "$ref": "#/components/parameters/id"
        }
      ],
      "get": {
        "parameters": [
          {
            "$ref": "#/components/parameters/cursor"
          },
          {
            "$ref": "#/components/parameters/limitExtended"
          }
        ],
        "operationId": "webhooks-attempts-list",
        "summary": "List delivery attempts (`eventType`, `successful` filters)",
        "responses": {
          "200": {
            "$ref": "#/components/responses/GenericList"
          }
        }
      }
    },
    "/v1/monitors": {
      "get": {
        "parameters": [
          {
            "$ref": "#/components/parameters/cursor"
          },
          {
            "$ref": "#/components/parameters/limitExtended"
          }
        ],
        "operationId": "monitors-list",
        "summary": "List monitors (`targetId` filters)",
        "responses": {
          "200": {
            "$ref": "#/components/responses/GenericList"
          }
        }
      },
      "post": {
        "operationId": "monitors-create",
        "summary": "Create a monitor that re-runs a Search on a cron cadence",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateMonitor"
              }
            }
          }
        },
        "responses": {
          "201": {
            "$ref": "#/components/responses/Object"
          }
        }
      }
    },
    "/v1/monitors/{id}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/id"
        }
      ],
      "get": {
        "operationId": "monitors-get",
        "summary": "Get a monitor",
        "responses": {
          "200": {
            "$ref": "#/components/responses/Object"
          }
        }
      },
      "patch": {
        "operationId": "monitors-update",
        "summary": "Update a monitor",
        "responses": {
          "200": {
            "$ref": "#/components/responses/Object"
          }
        }
      },
      "delete": {
        "operationId": "monitors-delete",
        "summary": "Delete a monitor",
        "responses": {
          "200": {
            "$ref": "#/components/responses/Object"
          }
        }
      }
    },
    "/v1/monitors/{monitor}/runs": {
      "parameters": [
        {
          "name": "monitor",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          }
        }
      ],
      "get": {
        "operationId": "monitors-runs-list",
        "parameters": [
          {
            "$ref": "#/components/parameters/cursor"
          },
          {
            "$ref": "#/components/parameters/limitExtended"
          }
        ],
        "summary": "List monitor runs",
        "responses": {
          "200": {
            "$ref": "#/components/responses/GenericList"
          }
        }
      }
    },
    "/v1/monitors/{monitor}/runs/{id}": {
      "parameters": [
        {
          "name": "monitor",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          }
        },
        {
          "$ref": "#/components/parameters/id"
        }
      ],
      "get": {
        "operationId": "monitors-runs-get",
        "summary": "Get a monitor run",
        "responses": {
          "200": {
            "$ref": "#/components/responses/Object"
          }
        }
      }
    },
    "/v1/imports": {
      "get": {
        "operationId": "imports-list",
        "parameters": [
          {
            "$ref": "#/components/parameters/cursor"
          },
          {
            "$ref": "#/components/parameters/limitExtended"
          }
        ],
        "summary": "List CSV imports",
        "responses": {
          "200": {
            "$ref": "#/components/responses/GenericList"
          }
        }
      },
      "post": {
        "operationId": "imports-create",
        "summary": "Declare a CSV import",
        "description": "The response carries `uploadUrl`; PUT the CSV there (the signed token authorises it).",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateImport"
              }
            }
          }
        },
        "responses": {
          "201": {
            "$ref": "#/components/responses/Object"
          }
        }
      }
    },
    "/v1/imports/{id}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/id"
        }
      ],
      "get": {
        "operationId": "imports-get",
        "summary": "Get an import",
        "responses": {
          "200": {
            "$ref": "#/components/responses/Object"
          }
        }
      },
      "patch": {
        "operationId": "imports-update",
        "summary": "Update title or metadata",
        "responses": {
          "200": {
            "$ref": "#/components/responses/Object"
          }
        }
      },
      "delete": {
        "operationId": "imports-delete",
        "summary": "Delete an import",
        "responses": {
          "200": {
            "$ref": "#/components/responses/Object"
          }
        }
      }
    },
    "/v1/imports/{id}/upload": {
      "parameters": [
        {
          "$ref": "#/components/parameters/id"
        },
        {
          "name": "token",
          "in": "query",
          "required": true,
          "schema": {
            "type": "string"
          }
        }
      ],
      "put": {
        "operationId": "imports-upload",
        "summary": "Upload the CSV body (no API key; the token authorises it)",
        "security": [],
        "requestBody": {
          "content": {
            "text/csv": {
              "schema": {
                "type": "string",
                "format": "binary"
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "Processing started"
          }
        }
      }
    },
    "/v1/credits": {
      "get": {
        "operationId": "credits-get",
        "summary": "Credit balance",
        "reserve": null,
        "plan and period usage": null,
        "responses": {
          "200": {
            "$ref": "#/components/responses/Object"
          }
        }
      }
    },
    "/v1/jobs/{id}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/id"
        }
      ],
      "get": {
        "operationId": "jobs-get",
        "summary": "Unified view of a Search",
        "monitor run": null,
        "import": null,
        "contact discovery or research report": null,
        "responses": {
          "200": {
            "$ref": "#/components/responses/Object"
          }
        }
      }
    },
    "/v1/jobs/{id}/cancel": {
      "parameters": [
        {
          "$ref": "#/components/parameters/id"
        }
      ],
      "post": {
        "operationId": "jobs-cancel",
        "summary": "Cancel a job",
        "responses": {
          "200": {
            "$ref": "#/components/responses/Object"
          }
        }
      }
    },
    "/v1/connect/accounts": {
      "get": {
        "operationId": "connect-accounts-list",
        "summary": "Connected outreach channels (never provider account ids)",
        "responses": {
          "200": {
            "$ref": "#/components/responses/Object"
          }
        }
      }
    },
    "/v1/customs/{operation}": {
      "parameters": [
        {
          "name": "operation",
          "in": "path",
          "required": true,
          "schema": {
            "enum": [
              "company-candidates",
              "discover-companies",
              "counterparties",
              "categories",
              "trend",
              "countries",
              "full-report"
            ]
          }
        }
      ],
      "post": {
        "operationId": "customs",
        "summary": "Customs data queries (scope `customs:read`)",
        "description": "Billable operations require an `Idempotency-Key` header.",
        "responses": {
          "200": {
            "$ref": "#/components/responses/Object"
          },
          "402": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "bearer": {
        "type": "http",
        "scheme": "bearer"
      },
      "apiKey": {
        "type": "apiKey",
        "in": "header",
        "name": "x-api-key"
      }
    },
    "parameters": {
      "target": {
        "name": "target",
        "in": "path",
        "required": true,
        "schema": {
          "type": "string"
        },
        "description": "Target id or externalId"
      },
      "id": {
        "name": "id",
        "in": "path",
        "required": true,
        "schema": {
          "type": "string"
        }
      },
      "cursor": {
        "name": "cursor",
        "in": "query",
        "schema": {
          "type": "string"
        }
      },
      "limit": {
        "name": "limit",
        "in": "query",
        "description": "Page size, 1-100 (targets and items; default 25 / 20).",
        "schema": {
          "type": "integer",
          "minimum": 1,
          "maximum": 100
        }
      },
      "limitExtended": {
        "name": "limit",
        "in": "query",
        "description": "Page size, 1-200 (events, webhooks, delivery attempts, monitors, runs, imports; default 25).",
        "schema": {
          "type": "integer",
          "minimum": 1,
          "maximum": 200,
          "default": 25
        }
      }
    },
    "responses": {
      "Error": {
        "description": "Error",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "Object": {
        "description": "Resource",
        "content": {
          "application/json": {
            "schema": {
              "type": "object"
            }
          }
        }
      },
      "GenericList": {
        "description": "Page of resources",
        "content": {
          "application/json": {
            "schema": {
              "type": "object",
              "properties": {
                "data": {
                  "type": "array",
                  "items": {
                    "type": "object"
                  }
                },
                "hasMore": {
                  "type": "boolean"
                },
                "nextCursor": {
                  "type": [
                    "string",
                    "null"
                  ]
                }
              }
            }
          }
        }
      },
      "Target": {
        "description": "Target",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Target"
            }
          }
        }
      },
      "TargetList": {
        "description": "Page of Targets",
        "content": {
          "application/json": {
            "schema": {
              "type": "object",
              "properties": {
                "data": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/Target"
                  }
                },
                "hasMore": {
                  "type": "boolean"
                },
                "nextCursor": {
                  "type": [
                    "string",
                    "null"
                  ]
                }
              }
            }
          }
        }
      },
      "ItemList": {
        "description": "Page of Items",
        "content": {
          "application/json": {
            "schema": {
              "type": "object",
              "properties": {
                "data": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/Item"
                  }
                },
                "hasMore": {
                  "type": "boolean"
                },
                "nextCursor": {
                  "type": [
                    "string",
                    "null"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "schemas": {
      "Error": {
        "type": "object",
        "required": [
          "error"
        ],
        "properties": {
          "error": {
            "type": "object",
            "required": [
              "code",
              "message"
            ],
            "properties": {
              "code": {
                "type": "string",
                "examples": [
                  "invalid_request",
                  "unauthorized",
                  "forbidden",
                  "not_found",
                  "conflict",
                  "insufficient_credits",
                  "rate_limited"
                ]
              },
              "message": {
                "type": "string"
              }
            }
          }
        }
      },
      "Metadata": {
        "type": "object",
        "maxProperties": 100,
        "additionalProperties": {
          "type": "string",
          "maxLength": 1000
        }
      },
      "Entity": {
        "type": "object",
        "required": [
          "type"
        ],
        "properties": {
          "type": {
            "enum": [
              "company",
              "person"
            ]
          }
        }
      },
      "OutputLanguage": {
        "type": "string",
        "enum": [
          "en",
          "zh",
          "es",
          "de",
          "fr",
          "pt",
          "ja"
        ],
        "default": "en",
        "description": "Language of agent-written free text (reasoning, text values, criteria and column titles). Not the search locale."
      },
      "CreateTarget": {
        "type": "object",
        "properties": {
          "outputLanguage": {
            "$ref": "#/components/schemas/OutputLanguage"
          },
          "search": {
            "type": "object",
            "required": [
              "query"
            ],
            "properties": {
              "query": {
                "type": "string"
              },
              "count": {
                "type": "integer",
                "minimum": 1,
                "default": 10
              },
              "entity": {
                "$ref": "#/components/schemas/Entity"
              },
              "criteria": {
                "type": "array",
                "maxItems": 5,
                "items": {
                  "type": "object",
                  "required": [
                    "description"
                  ],
                  "properties": {
                    "description": {
                      "type": "string"
                    }
                  }
                }
              },
              "exclude": {
                "type": "array",
                "items": {
                  "type": "object"
                }
              },
              "scope": {
                "type": "array",
                "items": {
                  "type": "object"
                }
              }
            }
          },
          "enrichments": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/EnrichmentInput"
            }
          },
          "externalId": {
            "type": "string"
          },
          "start": {
            "type": "boolean",
            "default": true
          },
          "metadata": {
            "$ref": "#/components/schemas/Metadata"
          }
        }
      },
      "CreateSearch": {
        "type": "object",
        "required": [
          "query"
        ],
        "properties": {
          "query": {
            "type": "string"
          },
          "count": {
            "type": "integer",
            "minimum": 1,
            "default": 10
          },
          "entity": {
            "$ref": "#/components/schemas/Entity"
          },
          "criteria": {
            "type": "array",
            "maxItems": 5,
            "items": {
              "type": "object",
              "properties": {
                "description": {
                  "type": "string"
                }
              }
            }
          },
          "behavior": {
            "enum": [
              "override",
              "append"
            ],
            "default": "override"
          },
          "exclude": {
            "type": "array",
            "items": {
              "type": "object"
            }
          },
          "scope": {
            "type": "array",
            "items": {
              "type": "object"
            }
          },
          "metadata": {
            "$ref": "#/components/schemas/Metadata"
          }
        }
      },
      "EnrichmentInput": {
        "type": "object",
        "required": [
          "description"
        ],
        "properties": {
          "description": "{ type: string }",
          "format": {
            "enum": [
              "text",
              "number",
              "options",
              "date",
              "email",
              "phone",
              "url"
            ]
          },
          "options": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "label": {
                  "type": "string"
                }
              }
            }
          },
          "researchDepth": {
            "type": "string"
          },
          "purpose": {
            "enum": [
              "outreach_hook"
            ]
          },
          "metadata": {
            "$ref": "#/components/schemas/Metadata"
          }
        }
      },
      "Target": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "object": {
            "const": "target"
          },
          "status": {
            "enum": [
              "draft",
              "running",
              "paused",
              "idle"
            ]
          },
          "externalId": {
            "type": [
              "string",
              "null"
            ]
          },
          "title": {
            "type": "string"
          },
          "searches": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Search"
            }
          },
          "enrichments": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Enrichment"
            }
          },
          "excludes": {
            "type": "array",
            "items": {
              "type": "object"
            }
          },
          "outputLanguage": {
            "$ref": "#/components/schemas/OutputLanguage"
          },
          "metadata": {
            "$ref": "#/components/schemas/Metadata"
          },
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Item"
            },
            "description": "Present with expand=items"
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "Search": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "object": {
            "const": "search"
          },
          "status": {
            "enum": [
              "draft",
              "queued",
              "running",
              "completed",
              "partial",
              "failed",
              "canceled"
            ]
          },
          "targetId": {
            "type": "string"
          },
          "query": {
            "type": "string"
          },
          "entity": {
            "$ref": "#/components/schemas/Entity"
          },
          "criteria": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "description": {
                  "type": "string"
                },
                "successRate": {
                  "type": "number"
                }
              }
            }
          },
          "count": {
            "type": "integer"
          },
          "behavior": {
            "enum": [
              "override",
              "append"
            ]
          },
          "progress": {
            "type": "object",
            "properties": {
              "found": {
                "type": "integer"
              },
              "analyzed": {
                "type": "integer"
              },
              "completion": {
                "type": "number"
              }
            }
          },
          "canceledAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "Enrichment": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "object": {
            "const": "enrichment"
          },
          "status": {
            "enum": [
              "pending",
              "completed",
              "canceled"
            ]
          },
          "targetId": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "description": "{ type: string }",
          "format": {
            "type": "string"
          },
          "options": {
            "type": [
              "array",
              "null"
            ]
          },
          "metadata": {
            "$ref": "#/components/schemas/Metadata"
          }
        }
      },
      "Item": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "object": {
            "const": "item"
          },
          "targetId": {
            "type": "string"
          },
          "searchId": {
            "type": "string"
          },
          "type": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "url": {
            "type": [
              "string",
              "null"
            ]
          },
          "profile": {
            "description": "Identity profile (D-85), decided with the identity; free, no Evidence. Company has industry and summary, person has summary. Null when unknown.",
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "industry": {
                "type": "string",
                "maxLength": 60
              },
              "summary": {
                "type": "string",
                "maxLength": 300
              }
            }
          },
          "identityKind": {
            "enum": [
              "official_domain",
              "social_only"
            ]
          },
          "evaluations": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "criterionId": {
                  "type": "string"
                },
                "criterion": {
                  "type": "string"
                },
                "status": {
                  "type": "string"
                },
                "reasoning": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "references": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "url": {
                        "type": "string"
                      },
                      "title": {
                        "type": [
                          "string",
                          "null"
                        ]
                      }
                    }
                  }
                }
              }
            }
          },
          "enrichments": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "enrichmentId": {
                  "type": "string"
                },
                "status": {
                  "enum": [
                    "pending",
                    "completed",
                    "canceled"
                  ]
                },
                "format": {
                  "type": "string"
                },
                "result": {},
                "reasoning": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "stale": {
                  "type": "boolean"
                }
              }
            }
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "EventType": {
        "enum": [
          "target.created",
          "target.updated",
          "target.deleted",
          "search.created",
          "search.updated",
          "search.completed",
          "search.canceled",
          "search.failed",
          "item.created",
          "enrichment.completed",
          "import.created",
          "import.completed",
          "import.deleted",
          "monitor.created",
          "monitor.updated",
          "monitor.deleted",
          "monitor.run.created",
          "monitor.run.completed",
          "monitor.run.canceled"
        ]
      },
      "Event": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "object": {
            "const": "event"
          },
          "type": {
            "type": "string"
          },
          "data": {
            "type": "object"
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "EventList": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Event"
            }
          },
          "hasMore": {
            "type": "boolean"
          },
          "nextCursor": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      },
      "CreateWebhook": {
        "type": "object",
        "required": [
          "url",
          "events"
        ],
        "properties": {
          "url": {
            "type": "string",
            "format": "uri"
          },
          "events": {
            "type": "array",
            "minItems": 1,
            "items": {
              "$ref": "#/components/schemas/EventType"
            }
          },
          "metadata": {
            "$ref": "#/components/schemas/Metadata"
          }
        }
      },
      "CreateMonitor": {
        "type": "object",
        "required": [
          "targetId",
          "cadence",
          "behavior"
        ],
        "properties": {
          "targetId": {
            "type": "string"
          },
          "cadence": {
            "type": "object",
            "required": [
              "cron"
            ],
            "properties": {
              "cron": {
                "type": "string"
              },
              "timezone": {
                "type": "string",
                "default": "Etc/UTC"
              }
            }
          },
          "behavior": {
            "type": "object",
            "required": [
              "type",
              "config"
            ],
            "properties": {
              "type": {
                "const": "search"
              },
              "config": {
                "type": "object",
                "required": [
                  "count"
                ],
                "properties": {
                  "query": {
                    "type": "string"
                  },
                  "count": {
                    "type": "integer"
                  },
                  "behavior": {
                    "enum": [
                      "override",
                      "append"
                    ],
                    "default": "append"
                  }
                }
              }
            }
          },
          "metadata": {
            "$ref": "#/components/schemas/Metadata"
          }
        }
      },
      "CreateImport": {
        "type": "object",
        "required": [
          "size",
          "count",
          "format",
          "entity"
        ],
        "properties": {
          "size": {
            "type": "integer",
            "description": "CSV size in bytes"
          },
          "count": {
            "type": "integer",
            "description": "Declared row count"
          },
          "title": {
            "type": "string"
          },
          "format": {
            "const": "csv"
          },
          "entity": {
            "$ref": "#/components/schemas/Entity"
          },
          "csv": {
            "type": "object",
            "properties": {
              "identifier": {
                "type": "integer",
                "description": "Zero-based identifier column"
              }
            }
          },
          "metadata": {
            "$ref": "#/components/schemas/Metadata"
          }
        }
      }
    }
  }
}
