{
  "openapi": "3.1.0",
  "info": {
    "title": "Sharelint API",
    "version": "1.0.0",
    "description": "Free link preview checker. See how any URL looks when shared on Facebook, WhatsApp, X, Telegram, LinkedIn, iMessage, Discord, Slack, Messenger, Instagram, Snapchat and TikTok, with per-platform fixes for Open Graph and Twitter Card tags."
  },
  "servers": [
    {
      "url": "https://sharelint.pages.dev"
    }
  ],
  "paths": {
    "/api/preview": {
      "get": {
        "operationId": "checkLinkPreview",
        "summary": "Check how a URL renders as a link preview on every platform",
        "parameters": [
          {
            "name": "url",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uri"
            },
            "description": "Public http(s) URL to check. The scheme is optional."
          },
          {
            "name": "crawler",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "facebook",
                "whatsapp",
                "twitter",
                "telegram",
                "linkedin",
                "discord",
                "slack",
                "imessage",
                "browser"
              ],
              "default": "facebook"
            },
            "description": "User-Agent to fetch the page with."
          },
          {
            "name": "format",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "json",
                "md"
              ],
              "default": "json"
            },
            "description": "md returns a Markdown report."
          }
        ],
        "responses": {
          "200": {
            "description": "Report",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "score": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 100
                    },
                    "pageIssues": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "level": {
                            "type": "string",
                            "enum": [
                              "error",
                              "warn",
                              "info"
                            ]
                          },
                          "message": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "level",
                          "message"
                        ]
                      }
                    },
                    "platforms": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "platform": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "name": {
                                "type": "string"
                              },
                              "category": {
                                "type": "string"
                              },
                              "surface": {
                                "type": "string"
                              },
                              "confidence": {
                                "type": "string"
                              }
                            }
                          },
                          "preview": {
                            "type": "object",
                            "properties": {
                              "title": {
                                "type": "string"
                              },
                              "description": {
                                "type": "string"
                              },
                              "domain": {
                                "type": "string"
                              },
                              "layout": {
                                "type": "string",
                                "enum": [
                                  "large",
                                  "small",
                                  "none"
                                ]
                              },
                              "image": {
                                "type": "object",
                                "properties": {
                                  "url": {
                                    "type": "string"
                                  }
                                }
                              },
                              "issues": {
                                "type": "array",
                                "items": {
                                  "type": "object",
                                  "properties": {
                                    "level": {
                                      "type": "string",
                                      "enum": [
                                        "error",
                                        "warn",
                                        "info"
                                      ]
                                    },
                                    "message": {
                                      "type": "string"
                                    }
                                  },
                                  "required": [
                                    "level",
                                    "message"
                                  ]
                                }
                              }
                            }
                          }
                        }
                      }
                    },
                    "result": {
                      "type": "object",
                      "description": "Raw fetch result: status, redirects, timing, meta tags and image probes."
                    }
                  }
                }
              },
              "text/markdown": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "description": "Invalid or private URL",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "502": {
            "description": "The target could not be fetched",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}