{
  "openapi": "3.1.0",
  "info": {
    "title": "Ibero.center Contact Enrichment",
    "version": "1.0.0",
    "description": "Pro: 10 contacts/month. Max: 50. Website and API share credits per subscriber. One credit only for a successful contact, once per person per UTC calendar month. Requires an eligible published profile and explicit enrichment permissions."
  },
  "servers": [
    {
      "url": "https://ibero.center"
    }
  ],
  "components": {
    "securitySchemes": {
      "apiKey": {
        "type": "http",
        "scheme": "bearer"
      },
      "dedicatedKey": {
        "type": "apiKey",
        "in": "header",
        "name": "X-Ibero-Api-Key"
      }
    },
    "schemas": {
      "Contact": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "email",
          "phone",
          "enrichedAt"
        ],
        "properties": {
          "email": {
            "type": [
              "string",
              "null"
            ],
            "format": "email"
          },
          "phone": {
            "type": [
              "string",
              "null"
            ]
          },
          "enrichedAt": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "Quota": {
        "type": "object",
        "required": [
          "planKey",
          "limit",
          "used",
          "pending",
          "remaining",
          "period",
          "resetsAt"
        ],
        "properties": {
          "planKey": {
            "type": [
              "string",
              "null"
            ],
            "enum": [
              "plus",
              "pro",
              "max",
              null
            ]
          },
          "limit": {
            "type": "integer"
          },
          "used": {
            "type": "integer"
          },
          "pending": {
            "type": "integer"
          },
          "remaining": {
            "type": "integer"
          },
          "period": {
            "type": "string",
            "format": "date"
          },
          "resetsAt": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "Result": {
        "type": "object",
        "required": [
          "contact",
          "cached",
          "charged",
          "quota"
        ],
        "properties": {
          "contact": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/Contact"
              },
              {
                "type": "null"
              }
            ]
          },
          "cached": {
            "type": "boolean"
          },
          "charged": {
            "type": "boolean"
          },
          "code": {
            "type": "string"
          },
          "quota": {
            "$ref": "#/components/schemas/Quota"
          }
        }
      },
      "Error": {
        "type": "object",
        "required": [
          "error"
        ],
        "properties": {
          "error": {
            "type": "string"
          },
          "quota": {
            "$ref": "#/components/schemas/Quota"
          }
        }
      }
    }
  },
  "paths": {
    "/api/v1/people/enrich": {
      "post": {
        "operationId": "enrichContact",
        "security": [
          {
            "apiKey": []
          },
          {
            "dedicatedKey": []
          }
        ],
        "description": "Use exactly one credential header. A company and its key family must enable enrichment and link an active Pro/Max subscription. Empty and cached results do not consume credits. Obey Retry-After for temporary failures.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "rut"
                ],
                "properties": {
                  "rut": {
                    "type": "string",
                    "minLength": 8,
                    "maxLength": 20
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Contact and quota; contact may be null. charged=false for empty or cached results.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Result"
                }
              }
            }
          },
          "400": {
            "description": "INVALID_INPUT or INVALID_RUT",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "INVALID_API_KEY",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "SERVICE_FORBIDDEN, COMPANY_DISABLED, SUBSCRIPTION_REQUIRED or ENRICHMENT_NOT_INCLUDED",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "PERSON_UNAVAILABLE",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "ENRICHMENT_PENDING or ENRICHMENT_EXPIRED",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Seconds before a retry for temporary failures. Monthly quota errors renew on quota.resetsAt.",
                "schema": {
                  "type": "integer"
                }
              }
            }
          },
          "415": {
            "description": "JSON_REQUIRED",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "ENRICHMENT_QUOTA_EXCEEDED, RATE_LIMITED or PROVIDER_BUSY",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Seconds before a retry for temporary failures. Monthly quota errors renew on quota.resetsAt.",
                "schema": {
                  "type": "integer"
                }
              }
            }
          },
          "503": {
            "description": "PROVIDER_UNAVAILABLE or ENRICHMENT_UNAVAILABLE",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Seconds before a retry for temporary failures. Monthly quota errors renew on quota.resetsAt.",
                "schema": {
                  "type": "integer"
                }
              }
            }
          }
        }
      }
    }
  }
}
