{
  "components": {
    "responses": {
      "E400": {
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/Problem"
            }
          }
        },
        "description": "Invalid request"
      },
      "E401": {
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/Problem"
            }
          }
        },
        "description": "Missing or invalid credential"
      },
      "E402": {
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/Problem"
            }
          }
        },
        "description": "Plan limit or entitlement"
      },
      "E403": {
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/Problem"
            }
          }
        },
        "description": "Forbidden: insufficient_scope (the key lacks a scope), key_surface_not_allowed (API keys work only on /api/v1/agent/ and /mcp), or a role/session requirement"
      },
      "E404": {
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/Problem"
            }
          }
        },
        "description": "Not found"
      },
      "E409": {
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/Problem"
            }
          }
        },
        "description": "Conflict (approval required, not schedulable, storage, key limit)"
      },
      "E413": {
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/Problem"
            }
          }
        },
        "description": "Too large"
      },
      "E422": {
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/Problem"
            }
          }
        },
        "description": "Text over a network limit"
      },
      "E429": {
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/Problem"
            }
          }
        },
        "description": "Rate limited; see Retry-After"
      },
      "E502": {
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/Problem"
            }
          }
        },
        "description": "Upstream failure"
      }
    },
    "schemas": {
      "Account": {
        "properties": {
          "can_publish": {
            "type": "boolean"
          },
          "display_name": {
            "type": "string"
          },
          "handle": {
            "type": "string"
          },
          "id": {
            "type": "string"
          },
          "max_media": {
            "type": "integer"
          },
          "max_text": {
            "description": "Network character limit.",
            "type": "integer"
          },
          "provider": {
            "description": "x, linkedin, bluesky, telegram, facebook, instagram, threads, tiktok, ...",
            "type": "string"
          },
          "provider_account_id": {
            "type": "string"
          },
          "publish_types": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "state": {
            "type": "string"
          }
        },
        "required": [
          "id",
          "provider",
          "state",
          "can_publish"
        ],
        "type": "object"
      },
      "ApiKey": {
        "properties": {
          "created_at": {
            "format": "date-time",
            "type": "string"
          },
          "created_by": {
            "type": "string"
          },
          "expires_at": {
            "format": "date-time",
            "type": [
              "string",
              "null"
            ]
          },
          "id": {
            "type": "string"
          },
          "last_used_at": {
            "format": "date-time",
            "type": [
              "string",
              "null"
            ]
          },
          "name": {
            "type": "string"
          },
          "prefix": {
            "description": "Display hint, e.g. gpk_...a1B2c3D4. Not the secret.",
            "type": "string"
          },
          "revoked_at": {
            "format": "date-time",
            "type": "string"
          },
          "scopes": {
            "items": {
              "enum": [
                "accounts:read",
                "media:write",
                "posts:read",
                "posts:write"
              ],
              "type": "string"
            },
            "type": "array"
          },
          "state": {
            "enum": [
              "active",
              "revoked",
              "expired"
            ],
            "type": "string"
          }
        },
        "required": [
          "id",
          "name",
          "prefix",
          "scopes",
          "created_at",
          "state"
        ],
        "type": "object"
      },
      "ApiKeyCreated": {
        "properties": {
          "key": {
            "$ref": "#/components/schemas/ApiKey"
          },
          "token": {
            "description": "gpk_... shown once; store it now.",
            "type": "string"
          }
        },
        "required": [
          "key",
          "token"
        ],
        "type": "object"
      },
      "ApiKeyList": {
        "properties": {
          "items": {
            "items": {
              "$ref": "#/components/schemas/ApiKey"
            },
            "type": "array"
          },
          "max_active": {
            "type": "integer"
          },
          "scopes": {
            "items": {
              "properties": {
                "description": {
                  "type": "string"
                },
                "grants": {
                  "items": {
                    "type": "string"
                  },
                  "type": "array"
                },
                "scope": {
                  "type": "string"
                }
              },
              "type": "object"
            },
            "type": "array"
          }
        },
        "required": [
          "items"
        ],
        "type": "object"
      },
      "CreateApiKeyRequest": {
        "additionalProperties": false,
        "properties": {
          "expires_at": {
            "format": "date-time",
            "type": "string"
          },
          "expires_in_days": {
            "maximum": 730,
            "minimum": 1,
            "type": "integer"
          },
          "name": {
            "maxLength": 80,
            "type": "string"
          },
          "scopes": {
            "items": {
              "enum": [
                "accounts:read",
                "media:write",
                "posts:read",
                "posts:write"
              ],
              "type": "string"
            },
            "minItems": 1,
            "type": "array"
          }
        },
        "required": [
          "name",
          "scopes"
        ],
        "type": "object"
      },
      "CreatePostRequest": {
        "additionalProperties": false,
        "properties": {
          "account_ids": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "campaign_id": {
            "type": "string"
          },
          "link": {
            "type": "string"
          },
          "media_ids": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "publish_now": {
            "type": "boolean"
          },
          "schedule_at": {
            "format": "date-time",
            "type": "string"
          },
          "text": {
            "type": "string"
          },
          "timezone": {
            "type": "string"
          },
          "title": {
            "type": "string"
          },
          "variants": {
            "additionalProperties": {
              "oneOf": [
                {
                  "type": "string"
                },
                {
                  "$ref": "#/components/schemas/Variant"
                }
              ]
            },
            "description": "Per-provider text: {\"x\": \"short\"} or {\"tiktok\": {\"text\": \"...\", \"options\": {...}}}.",
            "type": "object"
          },
          "workspace_id": {
            "type": "string"
          }
        },
        "required": [
          "text"
        ],
        "type": "object"
      },
      "CreatePostResult": {
        "properties": {
          "compliance": {
            "type": "object"
          },
          "post": {
            "$ref": "#/components/schemas/Post"
          }
        },
        "required": [
          "post"
        ],
        "type": "object"
      },
      "Me": {
        "description": "Fields depend on the credential: a session gets everything; an API key gets identity, scopes, rate limits and docs, plus plan.posts_month {used, limit} only with posts:write; an OAuth token gets tenant_id, principal and scopes, plus plan only with billing:read.",
        "properties": {
          "api_key": {
            "type": "object"
          },
          "docs": {
            "type": "object"
          },
          "plan": {
            "properties": {
              "limits": {
                "additionalProperties": {
                  "type": "integer"
                },
                "type": "object"
              },
              "plan": {
                "type": "string"
              },
              "read_only": {
                "type": "boolean"
              },
              "subscription": {
                "type": "string"
              },
              "usage": {
                "properties": {
                  "posts_month": {
                    "type": "integer"
                  }
                },
                "type": "object"
              }
            },
            "type": "object"
          },
          "principal": {
            "enum": [
              "api_key",
              "session",
              "oauth"
            ],
            "type": "string"
          },
          "rate_limits": {
            "type": "object"
          },
          "scopes": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "tenant_id": {
            "type": "string"
          },
          "user_id": {
            "type": "string"
          },
          "workspace_id": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "Media": {
        "properties": {
          "filename": {
            "type": "string"
          },
          "id": {
            "type": "string"
          },
          "mime_type": {
            "type": "string"
          },
          "rejection_reason": {
            "type": "string"
          },
          "rights_status": {
            "description": "unknown, owned, licensed or restricted.",
            "type": "string"
          },
          "scan_status": {
            "type": "string"
          },
          "size": {
            "type": "integer"
          },
          "state": {
            "description": "ready, or quarantined with a rejection_reason.",
            "type": "string"
          }
        },
        "required": [
          "id",
          "state"
        ],
        "type": "object"
      },
      "MediaRequest": {
        "additionalProperties": false,
        "properties": {
          "data_base64": {
            "description": "Inline file as base64 or a data: URL (about 12 MiB max).",
            "type": "string"
          },
          "filename": {
            "type": "string"
          },
          "mime_type": {
            "type": "string"
          },
          "rights_status": {
            "description": "The rights you hold over the file, recorded like the media library's rights control. Posts refuse media whose rights are unknown.",
            "enum": [
              "owned",
              "licensed"
            ],
            "type": "string"
          },
          "url": {
            "description": "Public HTTPS URL. Private and internal addresses are refused.",
            "format": "uri",
            "type": "string"
          }
        },
        "type": "object"
      },
      "Post": {
        "properties": {
          "approval_status": {
            "type": "string"
          },
          "created_at": {
            "format": "date-time",
            "type": "string"
          },
          "id": {
            "type": "string"
          },
          "link": {
            "type": "string"
          },
          "media_ids": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "publications": {
            "items": {
              "$ref": "#/components/schemas/Publication"
            },
            "type": "array"
          },
          "schedule": {
            "$ref": "#/components/schemas/Schedule"
          },
          "scheduled_at": {
            "type": "string"
          },
          "state": {
            "type": "string"
          },
          "text": {
            "type": "string"
          },
          "title": {
            "type": "string"
          },
          "updated_at": {
            "format": "date-time",
            "type": "string"
          },
          "variants": {
            "items": {
              "properties": {
                "media_ids": {
                  "items": {
                    "type": "string"
                  },
                  "type": "array"
                },
                "provider": {
                  "type": "string"
                },
                "text": {
                  "type": "string"
                }
              },
              "type": "object"
            },
            "type": "array"
          }
        },
        "required": [
          "id",
          "state"
        ],
        "type": "object"
      },
      "Problem": {
        "description": "RFC 9457 problem details.",
        "properties": {
          "code": {
            "description": "Stable machine code, e.g. invalid_token, insufficient_scope, text_limit_exceeded, approval_required, entitlement_required, rate_limited, validation_error, not_found.",
            "type": "string"
          },
          "details": {
            "description": "Per-account text-limit rows on 422.",
            "items": {
              "type": "object"
            },
            "type": "array"
          },
          "instance": {
            "type": "string"
          },
          "media_id": {
            "type": "string"
          },
          "post_created": {
            "type": "boolean"
          },
          "post_id": {
            "type": "string"
          },
          "request_id": {
            "type": "string"
          },
          "required_scope": {
            "type": "string"
          },
          "status": {
            "type": "integer"
          },
          "title": {
            "description": "Human readable reason.",
            "type": "string"
          },
          "type": {
            "type": "string"
          }
        },
        "required": [
          "type",
          "title",
          "status",
          "code"
        ],
        "type": "object"
      },
      "Publication": {
        "properties": {
          "account_id": {
            "type": "string"
          },
          "attempt_count": {
            "type": "integer"
          },
          "id": {
            "type": "string"
          },
          "last_error": {
            "type": "string"
          },
          "provider_post_id": {
            "type": "string"
          },
          "provider_url": {
            "type": "string"
          },
          "published_at": {
            "type": "string"
          },
          "scheduled_at": {
            "type": "string"
          },
          "state": {
            "description": "queued, publishing, published, submitted, retrying, failed, cancelled, ...",
            "type": "string"
          }
        },
        "type": "object"
      },
      "PublishRequest": {
        "additionalProperties": false,
        "properties": {
          "account_ids": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "timezone": {
            "type": "string"
          }
        },
        "required": [
          "account_ids"
        ],
        "type": "object"
      },
      "Schedule": {
        "properties": {
          "account_ids": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "id": {
            "type": "string"
          },
          "scheduled_at": {
            "type": "string"
          },
          "state": {
            "type": "string"
          },
          "timezone": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "ScheduleRequest": {
        "additionalProperties": false,
        "properties": {
          "account_ids": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "schedule_at": {
            "format": "date-time",
            "type": "string"
          },
          "timezone": {
            "type": "string"
          }
        },
        "required": [
          "account_ids",
          "schedule_at"
        ],
        "type": "object"
      },
      "ScheduleResult": {
        "properties": {
          "post_id": {
            "type": "string"
          },
          "publications": {
            "items": {
              "$ref": "#/components/schemas/Publication"
            },
            "type": "array"
          },
          "schedule": {
            "$ref": "#/components/schemas/Schedule"
          }
        },
        "type": "object"
      },
      "Variant": {
        "properties": {
          "link": {
            "type": "string"
          },
          "media_ids": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "options": {
            "type": "object"
          },
          "text": {
            "type": "string"
          },
          "title": {
            "type": "string"
          }
        },
        "type": "object"
      }
    },
    "securitySchemes": {
      "bearerAuth": {
        "bearerFormat": "gpk_\u003ctenant\u003e_\u003csecret\u003e",
        "description": "A workspace API key. A signed-in session token is also accepted.",
        "scheme": "bearer",
        "type": "http"
      }
    }
  },
  "info": {
    "description": "Create, schedule and publish social media posts from agents and scripts. Authenticate with a workspace API key (Settings \u003e API \u0026 Agents) sent as `Authorization: Bearer gpk_...`. Every operation runs through the same rules as the GPTpost web app: per-network text limits (422 text_limit_exceeded), workspace approval (409 approval_required), plan limits (402 entitlement_required) and tenant isolation. Errors use RFC 9457 problem details. Per key: 120 requests and 30 writes per minute (429 with Retry-After). The same operations are offered as MCP tools at POST /mcp.",
    "title": "GPTpost Agent API",
    "version": "1.0.0"
  },
  "openapi": "3.1.0",
  "paths": {
    "/api/v1/agent/accounts": {
      "get": {
        "description": "Connected social accounts posts can target. Requires accounts:read.",
        "operationId": "listAccounts",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "items": {
                      "items": {
                        "$ref": "#/components/schemas/Account"
                      },
                      "type": "array"
                    }
                  },
                  "required": [
                    "items"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Accounts"
          },
          "401": {
            "$ref": "#/components/responses/E401"
          },
          "403": {
            "$ref": "#/components/responses/E403"
          },
          "429": {
            "$ref": "#/components/responses/E429"
          }
        },
        "summary": "List social accounts",
        "tags": [
          "Agent"
        ]
      }
    },
    "/api/v1/agent/me": {
      "get": {
        "description": "Workspace, granted scopes, plan limits and this month's post usage for the calling credential.",
        "operationId": "getMe",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Me"
                }
              }
            },
            "description": "Caller context"
          },
          "401": {
            "$ref": "#/components/responses/E401"
          },
          "429": {
            "$ref": "#/components/responses/E429"
          }
        },
        "summary": "Who am I",
        "tags": [
          "Agent"
        ]
      }
    },
    "/api/v1/agent/media": {
      "post": {
        "description": "Upload an image, video or PDF from a public HTTPS url, inline base64, or multipart field `file`. Returns a media id for posts. Requires media:write.",
        "operationId": "uploadMedia",
        "parameters": [
          {
            "description": "Optional. Retrying with the same key returns the original result instead of acting twice (letters, digits and ._:- only, up to 128).",
            "in": "header",
            "name": "Idempotency-Key",
            "required": false,
            "schema": {
              "maxLength": 128,
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/MediaRequest"
              }
            },
            "multipart/form-data": {
              "schema": {
                "properties": {
                  "file": {
                    "format": "binary",
                    "type": "string"
                  },
                  "filename": {
                    "type": "string"
                  },
                  "mime_type": {
                    "type": "string"
                  },
                  "rights_status": {
                    "enum": [
                      "owned",
                      "licensed"
                    ],
                    "type": "string"
                  }
                },
                "required": [
                  "file"
                ],
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "media": {
                      "$ref": "#/components/schemas/Media"
                    }
                  },
                  "required": [
                    "media"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Uploaded"
          },
          "400": {
            "$ref": "#/components/responses/E400"
          },
          "401": {
            "$ref": "#/components/responses/E401"
          },
          "403": {
            "$ref": "#/components/responses/E403"
          },
          "409": {
            "$ref": "#/components/responses/E409"
          },
          "413": {
            "$ref": "#/components/responses/E413"
          },
          "429": {
            "$ref": "#/components/responses/E429"
          },
          "502": {
            "$ref": "#/components/responses/E502"
          }
        },
        "summary": "Upload media",
        "tags": [
          "Agent"
        ]
      }
    },
    "/api/v1/agent/posts": {
      "get": {
        "description": "Recent posts, newest first. Requires posts:read.",
        "operationId": "listPosts",
        "parameters": [
          {
            "description": "Filter by state, e.g. draft, scheduled, published, failed.",
            "in": "query",
            "name": "state",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "limit",
            "schema": {
              "default": 20,
              "maximum": 100,
              "minimum": 1,
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "cursor",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "items": {
                      "items": {
                        "$ref": "#/components/schemas/Post"
                      },
                      "type": "array"
                    },
                    "next_cursor": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "items"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Posts"
          },
          "401": {
            "$ref": "#/components/responses/E401"
          },
          "403": {
            "$ref": "#/components/responses/E403"
          },
          "429": {
            "$ref": "#/components/responses/E429"
          }
        },
        "summary": "List posts",
        "tags": [
          "Agent"
        ]
      },
      "post": {
        "description": "Create a draft, or schedule (schedule_at) or publish (publish_now) it in one call. account_ids are required to schedule or publish. Requires posts:write. When scheduling fails after the draft was created, the problem carries post_id and post_created=true.",
        "operationId": "createPost",
        "parameters": [
          {
            "description": "Optional. Retrying with the same key returns the original result instead of acting twice (letters, digits and ._:- only, up to 128).",
            "in": "header",
            "name": "Idempotency-Key",
            "required": false,
            "schema": {
              "maxLength": 128,
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreatePostRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CreatePostResult"
                }
              }
            },
            "description": "Created"
          },
          "400": {
            "$ref": "#/components/responses/E400"
          },
          "401": {
            "$ref": "#/components/responses/E401"
          },
          "402": {
            "$ref": "#/components/responses/E402"
          },
          "403": {
            "$ref": "#/components/responses/E403"
          },
          "404": {
            "$ref": "#/components/responses/E404"
          },
          "409": {
            "$ref": "#/components/responses/E409"
          },
          "422": {
            "$ref": "#/components/responses/E422"
          },
          "429": {
            "$ref": "#/components/responses/E429"
          }
        },
        "summary": "Create a post",
        "tags": [
          "Agent"
        ]
      }
    },
    "/api/v1/agent/posts/{id}": {
      "get": {
        "description": "One post with its variants, schedule and per-network publication states. Requires posts:read.",
        "operationId": "getPost",
        "parameters": [
          {
            "description": "Post id.",
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "post": {
                      "$ref": "#/components/schemas/Post"
                    }
                  },
                  "required": [
                    "post"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Post"
          },
          "401": {
            "$ref": "#/components/responses/E401"
          },
          "403": {
            "$ref": "#/components/responses/E403"
          },
          "404": {
            "$ref": "#/components/responses/E404"
          },
          "429": {
            "$ref": "#/components/responses/E429"
          }
        },
        "summary": "Get post status",
        "tags": [
          "Agent"
        ]
      }
    },
    "/api/v1/agent/posts/{id}/publish": {
      "post": {
        "description": "Publish a draft immediately on accounts. Delivery is asynchronous; poll getPost. Requires posts:write.",
        "operationId": "publishPost",
        "parameters": [
          {
            "description": "Post id.",
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Optional. Retrying with the same key returns the original result instead of acting twice (letters, digits and ._:- only, up to 128).",
            "in": "header",
            "name": "Idempotency-Key",
            "required": false,
            "schema": {
              "maxLength": 128,
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PublishRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ScheduleResult"
                }
              }
            },
            "description": "Queued for publishing"
          },
          "400": {
            "$ref": "#/components/responses/E400"
          },
          "401": {
            "$ref": "#/components/responses/E401"
          },
          "402": {
            "$ref": "#/components/responses/E402"
          },
          "403": {
            "$ref": "#/components/responses/E403"
          },
          "404": {
            "$ref": "#/components/responses/E404"
          },
          "409": {
            "$ref": "#/components/responses/E409"
          },
          "422": {
            "$ref": "#/components/responses/E422"
          },
          "429": {
            "$ref": "#/components/responses/E429"
          }
        },
        "summary": "Publish a post now",
        "tags": [
          "Agent"
        ]
      }
    },
    "/api/v1/agent/posts/{id}/schedule": {
      "post": {
        "description": "Schedule a draft on accounts at schedule_at. Requires posts:write.",
        "operationId": "schedulePost",
        "parameters": [
          {
            "description": "Post id.",
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Optional. Retrying with the same key returns the original result instead of acting twice (letters, digits and ._:- only, up to 128).",
            "in": "header",
            "name": "Idempotency-Key",
            "required": false,
            "schema": {
              "maxLength": 128,
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ScheduleRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ScheduleResult"
                }
              }
            },
            "description": "Scheduled"
          },
          "400": {
            "$ref": "#/components/responses/E400"
          },
          "401": {
            "$ref": "#/components/responses/E401"
          },
          "402": {
            "$ref": "#/components/responses/E402"
          },
          "403": {
            "$ref": "#/components/responses/E403"
          },
          "404": {
            "$ref": "#/components/responses/E404"
          },
          "409": {
            "$ref": "#/components/responses/E409"
          },
          "422": {
            "$ref": "#/components/responses/E422"
          },
          "429": {
            "$ref": "#/components/responses/E429"
          }
        },
        "summary": "Schedule a post",
        "tags": [
          "Agent"
        ]
      }
    },
    "/api/v1/api-keys": {
      "get": {
        "description": "Keys of this workspace (never the secret). Interactive owner/admin session only; an API key cannot call this.",
        "operationId": "listApiKeys",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiKeyList"
                }
              }
            },
            "description": "Keys"
          },
          "401": {
            "$ref": "#/components/responses/E401"
          },
          "403": {
            "$ref": "#/components/responses/E403"
          }
        },
        "summary": "List API keys",
        "tags": [
          "API keys"
        ]
      },
      "post": {
        "description": "Mint a key. The token is returned once, in this response only. Interactive owner/admin session only.",
        "operationId": "createApiKey",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateApiKeyRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiKeyCreated"
                }
              }
            },
            "description": "Created"
          },
          "400": {
            "$ref": "#/components/responses/E400"
          },
          "401": {
            "$ref": "#/components/responses/E401"
          },
          "402": {
            "$ref": "#/components/responses/E402"
          },
          "403": {
            "$ref": "#/components/responses/E403"
          },
          "409": {
            "$ref": "#/components/responses/E409"
          }
        },
        "summary": "Create an API key",
        "tags": [
          "API keys"
        ]
      }
    },
    "/api/v1/api-keys/{id}/revoke": {
      "post": {
        "description": "Revoke a key; it stops working immediately. Idempotent. Interactive owner/admin session only.",
        "operationId": "revokeApiKey",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "key": {
                      "$ref": "#/components/schemas/ApiKey"
                    }
                  },
                  "required": [
                    "key"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Revoked"
          },
          "401": {
            "$ref": "#/components/responses/E401"
          },
          "403": {
            "$ref": "#/components/responses/E403"
          },
          "404": {
            "$ref": "#/components/responses/E404"
          }
        },
        "summary": "Revoke an API key",
        "tags": [
          "API keys"
        ]
      }
    },
    "/mcp": {
      "post": {
        "description": "Model Context Protocol, streamable HTTP transport (protocol 2025-06-18, also 2025-03-26), JSON responses, stateless. Send JSON-RPC 2.0 messages: initialize, tools/list, tools/call (tools: whoami, list_accounts, create_post, schedule_post, publish_post, upload_media, get_post_status, list_posts). Notifications are answered 202. GET and DELETE answer 405. Browser requests from another origin are refused. Example: `claude mcp add --transport http gptpost https://app.oraglegpt.org/mcp --header \"Authorization: Bearer gpk_...\"`.",
        "operationId": "mcp",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "description": "A JSON-RPC 2.0 request, notification or batch.",
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            },
            "description": "JSON-RPC response"
          },
          "202": {
            "description": "Notification accepted"
          },
          "401": {
            "$ref": "#/components/responses/E401"
          },
          "403": {
            "$ref": "#/components/responses/E403"
          },
          "405": {
            "description": "Only POST is supported"
          },
          "429": {
            "$ref": "#/components/responses/E429"
          }
        },
        "summary": "Remote MCP endpoint",
        "tags": [
          "MCP"
        ]
      }
    }
  },
  "security": [
    {
      "bearerAuth": []
    }
  ],
  "servers": [
    {
      "url": "https://app.oraglegpt.org"
    }
  ],
  "tags": [
    {
      "description": "Agent REST facade",
      "name": "Agent"
    },
    {
      "description": "Key management, interactive owner/admin session only",
      "name": "API keys"
    },
    {
      "description": "Remote Model Context Protocol endpoint",
      "name": "MCP"
    }
  ]
}
