{
  "openapi": "3.1.0",
  "info": {
    "title": "Social Fanout GPT Action",
    "description": "List the caller's publish-capable Social Fanout connections and publish approved finished content to selected currently available destinations. Configure the Action with a customer-owned Social Fanout API key as Bearer authentication. Keep a GPT that uses this key private or restricted to people authorized to publish through that key.",
    "version": "1.0.0"
  },
  "servers": [
    {
      "url": "https://socialfanout.com"
    }
  ],
  "paths": {
    "/v1/publishing/connections": {
      "get": {
        "operationId": "listSocialFanoutPublishingConnections",
        "summary": "List active publish-capable connected accounts",
        "description": "List active publish-capable connections and their exact publishPlatforms; excludes Comments/Messages rows and never returns credentials or API-key fingerprints. Before publishing, show these accounts to the user and use a platform from the selected connection's publishPlatforms.",
        "responses": {
          "200": {
            "description": "Connected accounts owned by this Social Fanout key",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["ok", "connections"],
                  "properties": {
                    "ok": { "type": "boolean" },
                    "connections": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "required": ["id", "provider", "handle", "status", "publishPlatforms"],
                        "properties": {
                          "id": { "type": "string" },
                          "provider": { "type": "string" },
                          "handle": { "type": "string" },
                          "status": {
                            "type": "string",
                            "enum": ["active", "revoked"]
                          },
                          "brandLabel": { "type": "string" },
                          "publishPlatforms": {
                            "type": "array",
                            "minItems": 1,
                            "items": {
                              "type": "string",
                              "enum": [
                                "instagram",
                                "threads",
                                "facebook",
                                "tiktok",
                                "twitter",
                                "reddit",
                                "bluesky",
                                "discord"
                              ]
                            }
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/ApiError"
          }
        }
      }
    },
    "/v1/publish": {
      "post": {
        "operationId": "publishWithSocialFanout",
        "summary": "Dry run, publish, or schedule approved social content",
        "description": "Use dryRun=true to prepare. Set dryRun=false only after the user reviews the content, destinations, and schedule and explicitly confirms the live publish. Never retry successful targets. On failure, show the reason; fix or reconnect if needed before retrying only that target.",
        "x-openai-isConsequential": true,
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "required": ["text", "targets", "dryRun"],
                "properties": {
                  "text": {
                    "type": "string",
                    "minLength": 1,
                    "description": "The final user-approved post text."
                  },
                  "mediaUrls": {
                    "type": "array",
                    "description": "Publicly reachable media URLs already approved by the user.",
                    "items": {
                      "type": "string",
                      "format": "uri"
                    },
                    "default": []
                  },
                  "scheduledAt": {
                    "type": ["string", "null"],
                    "format": "date-time",
                    "description": "ISO-8601 date-time with timezone, or null to publish now."
                  },
                  "dryRun": {
                    "type": "boolean",
                    "description": "True checks routing and entitlements without sending or consuming quota. False can publish and requires explicit user confirmation.",
                    "default": true
                  },
                  "targets": {
                    "type": "array",
                    "minItems": 1,
                    "maxItems": 20,
                    "description": "Exact connected accounts reviewed by the user. Use ids returned by listSocialFanoutPublishingConnections and choose a platform listed in that connection's publishPlatforms.",
                    "items": {
                      "type": "object",
                      "additionalProperties": false,
                      "required": ["platform", "accountId"],
                      "properties": {
                        "platform": {
                          "type": "string",
                          "description": "A currently available social publishing destination.",
                          "enum": [
                            "instagram",
                            "threads",
                            "facebook",
                            "tiktok",
                            "twitter",
                            "reddit",
                            "bluesky",
                            "discord"
                          ]
                        },
                        "accountId": {
                          "type": "string",
                          "description": "The exact Social Fanout connection id selected from listSocialFanoutPublishingConnections."
                        },
                        "connectionId": {
                          "type": "string",
                          "description": "Usually the same Social Fanout connection id as accountId."
                        },
                        "pageId": {
                          "type": "string",
                          "description": "Optional Facebook Page id when a Meta connection contains multiple Pages."
                        },
                        "privacyLevel": {
                          "type": "string",
                          "description": "Optional provider-specific privacy level."
                        },
                        "publishMode": {
                          "type": "string",
                          "enum": ["direct", "draft"],
                          "description": "Optional provider-specific direct or draft mode."
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "One result per requested destination plus succeeded and failed counts",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FanoutResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ApiError"
          },
          "401": {
            "$ref": "#/components/responses/ApiError"
          },
          "402": {
            "$ref": "#/components/responses/ApiError"
          },
          "429": {
            "$ref": "#/components/responses/ApiError"
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "SocialFanoutApiKey": {
        "type": "http",
        "scheme": "bearer",
        "description": "A customer-owned Social Fanout API key. This is a server-to-server credential shared by every authorized user of the configured GPT; keep the GPT private or restricted and rotate the key if exposure is suspected."
      }
    },
    "responses": {
      "ApiError": {
        "description": "The request was not completed",
        "content": {
          "application/json": {
            "schema": {
              "type": "object",
              "properties": {
                "ok": { "type": "boolean" },
                "error": {
                  "type": "object",
                  "properties": {
                    "code": { "type": "string" },
                    "message": { "type": "string" }
                  }
                }
              }
            }
          }
        }
      }
    },
    "schemas": {
      "FanoutResponse": {
        "type": "object",
        "required": ["ok", "results", "summary"],
        "properties": {
          "ok": { "type": "boolean" },
          "results": {
            "type": "array",
            "items": {
              "type": "object",
              "required": ["platform", "ok"],
              "properties": {
                "platform": { "type": "string" },
                "accountId": { "type": ["string", "null"] },
                "ok": { "type": "boolean" },
                "jobId": { "type": "string" },
                "status": { "type": "string" },
                "providerPostId": { "type": ["string", "null"] },
                "url": { "type": "string", "format": "uri" },
                "code": { "type": "string" },
                "error": { "type": "string" }
              }
            }
          },
          "summary": {
            "type": "object",
            "required": ["requested", "succeeded", "failed"],
            "properties": {
              "requested": { "type": "integer" },
              "succeeded": { "type": "integer" },
              "failed": { "type": "integer" }
            }
          }
        }
      }
    }
  },
  "security": [
    {
      "SocialFanoutApiKey": []
    }
  ]
}
