{
  "openapi": "3.1.0",
  "info": {
    "title": "AccountPace Partner API",
    "version": "1.0.0-pilot",
    "description": "Direct HTTP pilot for Clay HTTP API and other server-side clients. Not a native Clay marketplace listing or partner certification. Requires an approved AccountPace workspace and scoped key. Evaluates supplied context and matching saved research; no independent web research, CRM writes or email sending.",
    "contact": {
      "name": "AccountPace / AVERY GRAY LLC",
      "email": "info@accountpace.com",
      "url": "https://accountpace.com/"
    },
    "termsOfService": "https://accountpace.com/terms/"
  },
  "servers": [
    {
      "url": "https://accountpace.com"
    }
  ],
  "security": [
    {
      "AccountPaceKey": []
    }
  ],
  "paths": {
    "/api/v1/accounts/evaluate": {
      "post": {
        "operationId": "evaluateAccount",
        "summary": "Evaluate an account with AccountPace",
        "description": "One account per request; 64 KiB body limit. Key scope accounts:evaluate. Unknown fields are rejected. The result is synchronous and not persisted.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "domain"
                ],
                "properties": {
                  "domain": {
                    "type": "string",
                    "description": "Public company domain or website URL.",
                    "maxLength": 300
                  },
                  "company_name": {
                    "type": "string",
                    "description": "Company name.",
                    "maxLength": 200
                  },
                  "business_case": {
                    "type": "string",
                    "description": "Specific business outcome or growth question.",
                    "maxLength": 5000
                  },
                  "commercial_product": {
                    "type": "boolean"
                  },
                  "paying_customers": {
                    "type": "boolean"
                  },
                  "b2b": {
                    "type": "boolean"
                  },
                  "signals": {
                    "type": "array",
                    "maxItems": 20,
                    "items": {
                      "type": "object",
                      "additionalProperties": false,
                      "required": [
                        "type",
                        "description"
                      ],
                      "properties": {
                        "type": {
                          "type": "string",
                          "enum": [
                            "funding",
                            "acquisition",
                            "new_revenue_leader",
                            "expansion",
                            "sales_hiring",
                            "investor_ownership",
                            "customer_growth"
                          ]
                        },
                        "description": {
                          "type": "string",
                          "description": "Caller-supplied observation; not independently verified.",
                          "maxLength": 1000
                        },
                        "source_url": {
                          "type": "string",
                          "format": "uri",
                          "maxLength": 2000
                        },
                        "observed_at": {
                          "type": "string",
                          "format": "date",
                          "description": "Valid calendar date; future dates are rejected."
                        }
                      }
                    }
                  }
                }
              },
              "example": {
                "domain": "bentwood.example",
                "company_name": "Bentwood (fictional)",
                "business_case": "Expand an established AI product into adjacent enterprise use cases.",
                "commercial_product": true,
                "paying_customers": true,
                "b2b": true,
                "signals": []
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Rules-based evaluation; no records are changed.",
            "headers": {
              "X-Request-Id": {
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data",
                    "request_id"
                  ],
                  "properties": {
                    "data": {
                      "type": "object",
                      "required": [
                        "api_version",
                        "assessment_version",
                        "domain",
                        "company_name",
                        "workspace_match",
                        "priority_score",
                        "priority_basis",
                        "priority_reasons",
                        "missing_fields",
                        "business_case",
                        "business_drivers",
                        "buying_groups",
                        "next_action",
                        "outreach_drafts",
                        "outreach_controls",
                        "limitations"
                      ],
                      "properties": {
                        "api_version": {
                          "const": "1"
                        },
                        "assessment_version": {
                          "const": "pilot-rules-1"
                        },
                        "domain": {
                          "type": "string",
                          "description": "Normalized company domain."
                        },
                        "company_name": {
                          "type": "string",
                          "description": "Supplied name, saved account name, or domain."
                        },
                        "workspace_match": {
                          "type": "boolean"
                        },
                        "priority_score": {
                          "anyOf": [
                            {
                              "type": "integer",
                              "minimum": 1,
                              "maximum": 5
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "priority_basis": {
                          "type": "string",
                          "enum": [
                            "caller_supplied_rules",
                            "saved_workspace_assessment",
                            "insufficient_information"
                          ]
                        },
                        "priority_reasons": {
                          "type": "array",
                          "items": {
                            "type": "string",
                            "description": "Reason for the assessment."
                          }
                        },
                        "missing_fields": {
                          "type": "array",
                          "items": {
                            "type": "string",
                            "enum": [
                              "commercial_product",
                              "paying_customers",
                              "b2b"
                            ]
                          }
                        },
                        "business_case": {
                          "anyOf": [
                            {
                              "type": "string",
                              "description": "Submitted context or matching workspace use case."
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "business_drivers": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "required": [
                              "type",
                              "description",
                              "source_url",
                              "observed_at",
                              "verification"
                            ],
                            "properties": {
                              "type": {
                                "type": "string",
                                "enum": [
                                  "funding",
                                  "acquisition",
                                  "new_revenue_leader",
                                  "expansion",
                                  "sales_hiring",
                                  "investor_ownership",
                                  "customer_growth"
                                ]
                              },
                              "description": {
                                "type": "string",
                                "description": "Supplied observation."
                              },
                              "source_url": {
                                "anyOf": [
                                  {
                                    "type": "string",
                                    "format": "uri"
                                  },
                                  {
                                    "type": "null"
                                  }
                                ]
                              },
                              "observed_at": {
                                "anyOf": [
                                  {
                                    "type": "string",
                                    "format": "date"
                                  },
                                  {
                                    "type": "null"
                                  }
                                ]
                              },
                              "verification": {
                                "const": "caller_supplied_not_independently_verified"
                              }
                            }
                          }
                        },
                        "buying_groups": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "required": [
                              "role",
                              "suggested_title",
                              "pain_to_validate",
                              "channel",
                              "cadence",
                              "authority_verified"
                            ],
                            "properties": {
                              "role": {
                                "type": "string",
                                "enum": [
                                  "budget_owner",
                                  "technical_buyer",
                                  "executive_stakeholder"
                                ]
                              },
                              "suggested_title": {
                                "type": "string",
                                "description": "Role hypothesis; not a named or verified buyer."
                              },
                              "pain_to_validate": {
                                "type": "string",
                                "description": "Problem to discuss."
                              },
                              "channel": {
                                "type": "string",
                                "description": "Suggested communication channel."
                              },
                              "cadence": {
                                "type": "string",
                                "description": "Suggested timing; never automatically scheduled."
                              },
                              "authority_verified": {
                                "const": false
                              }
                            }
                          },
                          "minItems": 3,
                          "maxItems": 3
                        },
                        "next_action": {
                          "type": "string",
                          "description": "Recommended next step, respecting outreach restrictions."
                        },
                        "outreach_drafts": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "required": [
                              "role",
                              "subject",
                              "body",
                              "review_required"
                            ],
                            "properties": {
                              "role": {
                                "type": "string",
                                "enum": [
                                  "budget_owner",
                                  "technical_buyer",
                                  "executive_stakeholder"
                                ]
                              },
                              "subject": {
                                "type": "string",
                                "description": "Draft subject."
                              },
                              "body": {
                                "type": "string",
                                "description": "Draft email with recipient and signature placeholders."
                              },
                              "review_required": {
                                "const": true
                              }
                            }
                          },
                          "maxItems": 3
                        },
                        "outreach_controls": {
                          "type": "object",
                          "required": [
                            "suppressed",
                            "paused",
                            "technical_concern"
                          ],
                          "properties": {
                            "suppressed": {
                              "type": "boolean"
                            },
                            "paused": {
                              "type": "boolean"
                            },
                            "technical_concern": {
                              "type": "boolean"
                            }
                          }
                        },
                        "limitations": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        }
                      }
                    },
                    "request_id": {
                      "type": "string",
                      "format": "uuid"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Request failed. Inspect code and request_id.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Request failed. Inspect code and request_id.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Request failed. Inspect code and request_id.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Request failed. Inspect code and request_id.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "405": {
            "description": "Request failed. Inspect code and request_id.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Request failed. Inspect code and request_id.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "415": {
            "description": "Request failed. Inspect code and request_id.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "30 requests/minute or 1,000 requests/UTC day per key exceeded.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer",
                  "minimum": 1
                }
              }
            }
          },
          "503": {
            "description": "Request failed. Inspect code and request_id.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "AccountPaceKey": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "AccountPace API key",
        "description": "Create at https://accountpace.com/app/integrations/. Scope accounts:evaluate; expires after 90 days; revocable. Never put it in a URL or table cell."
      }
    },
    "schemas": {
      "Error": {
        "type": "object",
        "required": [
          "error",
          "request_id"
        ],
        "properties": {
          "error": {
            "type": "object",
            "required": [
              "code",
              "message"
            ],
            "properties": {
              "code": {
                "type": "string"
              },
              "message": {
                "type": "string"
              }
            }
          },
          "request_id": {
            "type": "string",
            "format": "uuid"
          }
        }
      }
    }
  }
}
