{
  "openapi": "3.1.0",
  "info": {
    "title": "mynameiskalam.com contact API",
    "version": "1.0.0",
    "summary": "Send an enquiry to Muhammed Abdul Kalam, a performance marketing consultant in Kochi, Kerala.",
    "description": "One endpoint. A request is validated and forwarded to Kalam's inbox as a project brief. Use it to send a genuine enquiry on behalf of a real person or business. Human-readable documentation: https://mynameiskalam.com/api-docs/contact/",
    "contact": {
      "name": "Muhammed Abdul Kalam",
      "url": "https://mynameiskalam.com/contact-us/"
    }
  },
  "servers": [
    {
      "url": "https://mynameiskalam.com"
    }
  ],
  "paths": {
    "/api/contact": {
      "post": {
        "operationId": "sendEnquiry",
        "summary": "Send an enquiry",
        "description": "Sends a project brief to Kalam. Every other HTTP method returns 405 method_not_allowed. When the site has Cloudflare Turnstile switched on, a request needs a valid cf-turnstile-response token and a client without one receives 403.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/Enquiry"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The enquiry was accepted and forwarded.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "ok"
                  ],
                  "properties": {
                    "ok": {
                      "const": true
                    }
                  }
                },
                "example": {
                  "ok": true
                }
              }
            }
          },
          "400": {
            "description": "The body is not a JSON object.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "ok": false,
                  "error": "invalid_body"
                }
              }
            }
          },
          "403": {
            "description": "Turnstile verification is required and the token is missing or invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "ok": false,
                  "error": "turnstile_missing"
                }
              }
            }
          },
          "405": {
            "description": "The method is not POST.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "ok": false,
                  "error": "method_not_allowed"
                }
              }
            }
          },
          "422": {
            "description": "A field failed validation. \"fields\" maps each failing field to required, invalid or too_short.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "ok",
                    "error",
                    "fields"
                  ],
                  "properties": {
                    "ok": {
                      "const": false
                    },
                    "error": {
                      "const": "validation"
                    },
                    "fields": {
                      "type": "object",
                      "additionalProperties": {
                        "enum": [
                          "required",
                          "invalid",
                          "too_short"
                        ]
                      }
                    }
                  }
                },
                "example": {
                  "ok": false,
                  "error": "validation",
                  "fields": {
                    "email": "invalid"
                  }
                }
              }
            }
          },
          "502": {
            "description": "The enquiry could not be delivered, or Turnstile could not be reached. Try again later.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "ok": false,
                  "error": "delivery_failed"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Enquiry": {
        "type": "object",
        "required": [
          "name",
          "email",
          "services",
          "message"
        ],
        "properties": {
          "name": {
            "type": "string",
            "maxLength": 120,
            "description": "Sender's name. At least 2 characters.",
            "minLength": 2
          },
          "email": {
            "type": "string",
            "maxLength": 200,
            "description": "Address Kalam replies to.",
            "format": "email"
          },
          "services": {
            "type": "array",
            "minItems": 1,
            "description": "What the sender needs help with. At least one.",
            "items": {
              "enum": [
                "Google Ads / SEM",
                "Meta Ads / social advertising",
                "SEO",
                "Website development",
                "Shopify store development",
                "Brand video production",
                "Brand strategy",
                "Social media marketing",
                "Something else"
              ]
            }
          },
          "message": {
            "type": "string",
            "maxLength": 5000,
            "description": "The brief: what the business does and what it wants. At least 20 characters.",
            "minLength": 20
          },
          "phone_code": {
            "type": "string",
            "maxLength": 6,
            "description": "Dialling code, for example \"+91\"."
          },
          "phone": {
            "type": "string",
            "maxLength": 20,
            "description": "Phone number, 5 to 15 digits. Optional."
          },
          "company": {
            "type": "string",
            "maxLength": 200,
            "description": "Company name or website. Optional."
          },
          "budget": {
            "type": "string",
            "maxLength": 80,
            "description": "Monthly budget as free text. Optional."
          },
          "budget_currency": {
            "type": "string",
            "maxLength": 3,
            "description": "Currency of the budget, for example \"INR\" or \"USD\". Defaults to INR."
          },
          "timeline": {
            "type": "string",
            "maxLength": 40,
            "description": "When the sender wants to start. Optional.",
            "examples": [
              "As soon as possible",
              "Within a month",
              "1 to 3 months",
              "Just exploring"
            ]
          },
          "from": {
            "type": "string",
            "maxLength": 60,
            "description": "Which part of the site the enquiry came from. Optional, for attribution."
          },
          "ref": {
            "type": "string",
            "maxLength": 120,
            "description": "Which page it came from. Optional, for attribution."
          },
          "page_url": {
            "type": "string",
            "maxLength": 300,
            "description": "URL of the page the sender was on. Optional."
          },
          "referrer": {
            "type": "string",
            "maxLength": 300,
            "description": "Referring URL. Optional."
          },
          "utm_source": {
            "type": "string",
            "maxLength": 120,
            "description": "Optional campaign attribution."
          },
          "utm_medium": {
            "type": "string",
            "maxLength": 120,
            "description": "Optional campaign attribution."
          },
          "utm_campaign": {
            "type": "string",
            "maxLength": 120,
            "description": "Optional campaign attribution."
          },
          "utm_term": {
            "type": "string",
            "maxLength": 120,
            "description": "Optional campaign attribution."
          },
          "utm_content": {
            "type": "string",
            "maxLength": 120,
            "description": "Optional campaign attribution."
          },
          "submitted_at": {
            "type": "string",
            "maxLength": 40,
            "description": "ISO 8601 timestamp. Defaults to the time the request is received."
          },
          "cf-turnstile-response": {
            "type": "string",
            "maxLength": 2048,
            "description": "Cloudflare Turnstile token. Required when the site has Turnstile switched on."
          },
          "website_url": {
            "type": "string",
            "maxLength": 200,
            "description": "Spam trap. Leave empty. A request that fills it is acknowledged with ok:true and discarded."
          }
        }
      },
      "Error": {
        "type": "object",
        "required": [
          "ok",
          "error"
        ],
        "properties": {
          "ok": {
            "const": false
          },
          "error": {
            "type": "string"
          }
        }
      }
    }
  }
}
