{
  "openapi": "3.1.0",
  "info": {
    "title": "SkedCast API",
    "version": "1.0.0",
    "summary": "Schedule posts, read analytics, and connect AI agents to SkedCast.",
    "description": "The public SkedCast REST API. Authenticate with a Developer API key or an OAuth 2.1 bearer token (both sent as `Authorization: Bearer …`). Responses use a `{ data, meta }` / `{ data, page, meta }` envelope; lists are keyset-paginated; errors are RFC 9457 problem+json. See https://skedcast.com/developers.",
    "contact": {
      "name": "SkedCast Developers",
      "url": "https://skedcast.com/developers"
    },
    "license": {
      "name": "Proprietary"
    }
  },
  "servers": [
    {
      "url": "https://api.skedcast.com/v1",
      "description": "Production"
    }
  ],
  "tags": [
    {
      "name": "Posts",
      "description": "Read and compose scheduled posts."
    },
    {
      "name": "Clients",
      "description": "Client groups (brands / influencers)."
    },
    {
      "name": "Accounts",
      "description": "Connected social accounts."
    },
    {
      "name": "Agency",
      "description": "The current workspace profile."
    },
    {
      "name": "Analytics",
      "description": "Reach, impressions, engagement, and rollups."
    },
    {
      "name": "Reports",
      "description": "Saved analytics report definitions and exports."
    },
    {
      "name": "Best times",
      "description": "Recommended posting times."
    },
    {
      "name": "Media",
      "description": "The content library (digital asset management)."
    }
  ],
  "security": [
    {
      "ApiKey": []
    }
  ],
  "paths": {
    "/posts": {
      "get": {
        "tags": [
          "Posts"
        ],
        "summary": "List posts",
        "description": "Requires the `posts.read` scope.",
        "operationId": "listPosts",
        "x-required-scope": "posts.read",
        "parameters": [
          {
            "$ref": "#/components/parameters/Cursor"
          },
          {
            "$ref": "#/components/parameters/Limit"
          },
          {
            "name": "status",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "clientId",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "platform",
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "ApiKey": []
          },
          {
            "OAuth2": [
              "posts.read"
            ]
          }
        ],
        "responses": {
          "200": {
            "description": "A page of posts.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data",
                    "page",
                    "meta"
                  ],
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "additionalProperties": true
                      }
                    },
                    "page": {
                      "$ref": "#/components/schemas/PageMeta"
                    },
                    "meta": {
                      "$ref": "#/components/schemas/ResponseMeta"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Problem"
          },
          "401": {
            "$ref": "#/components/responses/Problem"
          },
          "403": {
            "$ref": "#/components/responses/Problem"
          },
          "404": {
            "$ref": "#/components/responses/Problem"
          },
          "422": {
            "$ref": "#/components/responses/Problem"
          },
          "429": {
            "$ref": "#/components/responses/Problem"
          }
        }
      },
      "post": {
        "tags": [
          "Posts"
        ],
        "summary": "Create a post",
        "description": "Compose a post and fan it out across the selected accounts (or save it as a draft). Requires the `posts.compose` scope and an `Idempotency-Key` header.",
        "operationId": "createPost",
        "x-required-scope": "posts.compose",
        "security": [
          {
            "ApiKey": []
          },
          {
            "OAuth2": [
              "posts.compose"
            ]
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "clientId",
                  "targets",
                  "schedule"
                ],
                "properties": {
                  "clientId": {
                    "type": "string",
                    "format": "uuid"
                  },
                  "content": {
                    "type": "string"
                  },
                  "mediaIds": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "format": "uuid"
                    }
                  },
                  "targets": {
                    "type": "object",
                    "additionalProperties": true
                  },
                  "schedule": {
                    "type": "object",
                    "additionalProperties": true
                  }
                },
                "additionalProperties": true
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The created post.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data",
                    "meta"
                  ],
                  "properties": {
                    "data": {
                      "type": "object",
                      "additionalProperties": true
                    },
                    "meta": {
                      "$ref": "#/components/schemas/ResponseMeta"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Problem"
          },
          "401": {
            "$ref": "#/components/responses/Problem"
          },
          "403": {
            "$ref": "#/components/responses/Problem"
          },
          "404": {
            "$ref": "#/components/responses/Problem"
          },
          "422": {
            "$ref": "#/components/responses/Problem"
          },
          "429": {
            "$ref": "#/components/responses/Problem"
          }
        }
      }
    },
    "/posts/{id}": {
      "get": {
        "tags": [
          "Posts"
        ],
        "summary": "Get a post",
        "description": "Requires the `posts.read` scope.",
        "operationId": "getPost",
        "x-required-scope": "posts.read",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdPath"
          }
        ],
        "security": [
          {
            "ApiKey": []
          },
          {
            "OAuth2": [
              "posts.read"
            ]
          }
        ],
        "responses": {
          "200": {
            "description": "The post + variants + targets.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data",
                    "meta"
                  ],
                  "properties": {
                    "data": {
                      "type": "object",
                      "additionalProperties": true
                    },
                    "meta": {
                      "$ref": "#/components/schemas/ResponseMeta"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Problem"
          },
          "401": {
            "$ref": "#/components/responses/Problem"
          },
          "403": {
            "$ref": "#/components/responses/Problem"
          },
          "404": {
            "$ref": "#/components/responses/Problem"
          },
          "422": {
            "$ref": "#/components/responses/Problem"
          },
          "429": {
            "$ref": "#/components/responses/Problem"
          }
        }
      }
    },
    "/clients": {
      "get": {
        "tags": [
          "Clients"
        ],
        "summary": "List clients",
        "description": "Requires the `clients.read` scope.",
        "operationId": "listClients",
        "x-required-scope": "clients.read",
        "parameters": [
          {
            "$ref": "#/components/parameters/Cursor"
          },
          {
            "$ref": "#/components/parameters/Limit"
          },
          {
            "name": "type",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "influencer",
                "brand"
              ]
            }
          },
          {
            "name": "search",
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "ApiKey": []
          },
          {
            "OAuth2": [
              "clients.read"
            ]
          }
        ],
        "responses": {
          "200": {
            "description": "A page of clients.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data",
                    "page",
                    "meta"
                  ],
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "additionalProperties": true
                      }
                    },
                    "page": {
                      "$ref": "#/components/schemas/PageMeta"
                    },
                    "meta": {
                      "$ref": "#/components/schemas/ResponseMeta"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Problem"
          },
          "401": {
            "$ref": "#/components/responses/Problem"
          },
          "403": {
            "$ref": "#/components/responses/Problem"
          },
          "404": {
            "$ref": "#/components/responses/Problem"
          },
          "422": {
            "$ref": "#/components/responses/Problem"
          },
          "429": {
            "$ref": "#/components/responses/Problem"
          }
        }
      }
    },
    "/clients/{id}": {
      "get": {
        "tags": [
          "Clients"
        ],
        "summary": "Get a client",
        "description": "Requires the `clients.read` scope.",
        "operationId": "getClient",
        "x-required-scope": "clients.read",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdPath"
          }
        ],
        "security": [
          {
            "ApiKey": []
          },
          {
            "OAuth2": [
              "clients.read"
            ]
          }
        ],
        "responses": {
          "200": {
            "description": "The client.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data",
                    "meta"
                  ],
                  "properties": {
                    "data": {
                      "type": "object",
                      "additionalProperties": true
                    },
                    "meta": {
                      "$ref": "#/components/schemas/ResponseMeta"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Problem"
          },
          "401": {
            "$ref": "#/components/responses/Problem"
          },
          "403": {
            "$ref": "#/components/responses/Problem"
          },
          "404": {
            "$ref": "#/components/responses/Problem"
          },
          "422": {
            "$ref": "#/components/responses/Problem"
          },
          "429": {
            "$ref": "#/components/responses/Problem"
          }
        }
      }
    },
    "/accounts": {
      "get": {
        "tags": [
          "Accounts"
        ],
        "summary": "List connected accounts",
        "description": "Requires the `accounts.read` scope.",
        "operationId": "listAccounts",
        "x-required-scope": "accounts.read",
        "parameters": [
          {
            "$ref": "#/components/parameters/Cursor"
          },
          {
            "$ref": "#/components/parameters/Limit"
          },
          {
            "name": "clientId",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "platform",
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "ApiKey": []
          },
          {
            "OAuth2": [
              "accounts.read"
            ]
          }
        ],
        "responses": {
          "200": {
            "description": "A page of connected accounts.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data",
                    "page",
                    "meta"
                  ],
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "additionalProperties": true
                      }
                    },
                    "page": {
                      "$ref": "#/components/schemas/PageMeta"
                    },
                    "meta": {
                      "$ref": "#/components/schemas/ResponseMeta"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Problem"
          },
          "401": {
            "$ref": "#/components/responses/Problem"
          },
          "403": {
            "$ref": "#/components/responses/Problem"
          },
          "404": {
            "$ref": "#/components/responses/Problem"
          },
          "422": {
            "$ref": "#/components/responses/Problem"
          },
          "429": {
            "$ref": "#/components/responses/Problem"
          }
        }
      }
    },
    "/accounts/{id}": {
      "get": {
        "tags": [
          "Accounts"
        ],
        "summary": "Get a connected account",
        "description": "Requires the `accounts.read` scope.",
        "operationId": "getAccount",
        "x-required-scope": "accounts.read",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdPath"
          }
        ],
        "security": [
          {
            "ApiKey": []
          },
          {
            "OAuth2": [
              "accounts.read"
            ]
          }
        ],
        "responses": {
          "200": {
            "description": "The connected account.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data",
                    "meta"
                  ],
                  "properties": {
                    "data": {
                      "type": "object",
                      "additionalProperties": true
                    },
                    "meta": {
                      "$ref": "#/components/schemas/ResponseMeta"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Problem"
          },
          "401": {
            "$ref": "#/components/responses/Problem"
          },
          "403": {
            "$ref": "#/components/responses/Problem"
          },
          "404": {
            "$ref": "#/components/responses/Problem"
          },
          "422": {
            "$ref": "#/components/responses/Problem"
          },
          "429": {
            "$ref": "#/components/responses/Problem"
          }
        }
      }
    },
    "/agency": {
      "get": {
        "tags": [
          "Agency"
        ],
        "summary": "Get the current workspace",
        "description": "Requires the `agency.read` scope.",
        "operationId": "getAgency",
        "x-required-scope": "agency.read",
        "security": [
          {
            "ApiKey": []
          },
          {
            "OAuth2": [
              "agency.read"
            ]
          }
        ],
        "responses": {
          "200": {
            "description": "The workspace profile.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data",
                    "meta"
                  ],
                  "properties": {
                    "data": {
                      "type": "object",
                      "additionalProperties": true
                    },
                    "meta": {
                      "$ref": "#/components/schemas/ResponseMeta"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Problem"
          },
          "401": {
            "$ref": "#/components/responses/Problem"
          },
          "403": {
            "$ref": "#/components/responses/Problem"
          },
          "404": {
            "$ref": "#/components/responses/Problem"
          },
          "422": {
            "$ref": "#/components/responses/Problem"
          },
          "429": {
            "$ref": "#/components/responses/Problem"
          }
        }
      }
    },
    "/analytics/overview": {
      "get": {
        "tags": [
          "Analytics"
        ],
        "summary": "Analytics overview",
        "description": "Requires the `analytics.read` scope.",
        "operationId": "analyticsOverview",
        "x-required-scope": "analytics.read",
        "parameters": [
          {
            "$ref": "#/components/parameters/From"
          },
          {
            "$ref": "#/components/parameters/To"
          }
        ],
        "security": [
          {
            "ApiKey": []
          },
          {
            "OAuth2": [
              "analytics.read"
            ]
          }
        ],
        "responses": {
          "200": {
            "description": "Tenant rollup + per-platform + daily series.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data",
                    "meta"
                  ],
                  "properties": {
                    "data": {
                      "type": "object",
                      "additionalProperties": true
                    },
                    "meta": {
                      "$ref": "#/components/schemas/ResponseMeta"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Problem"
          },
          "401": {
            "$ref": "#/components/responses/Problem"
          },
          "403": {
            "$ref": "#/components/responses/Problem"
          },
          "404": {
            "$ref": "#/components/responses/Problem"
          },
          "422": {
            "$ref": "#/components/responses/Problem"
          },
          "429": {
            "$ref": "#/components/responses/Problem"
          }
        }
      }
    },
    "/analytics/posts": {
      "get": {
        "tags": [
          "Analytics"
        ],
        "summary": "Per-post analytics",
        "description": "Requires the `analytics.read` scope.",
        "operationId": "analyticsPosts",
        "x-required-scope": "analytics.read",
        "parameters": [
          {
            "$ref": "#/components/parameters/Cursor"
          },
          {
            "$ref": "#/components/parameters/Limit"
          }
        ],
        "security": [
          {
            "ApiKey": []
          },
          {
            "OAuth2": [
              "analytics.read"
            ]
          }
        ],
        "responses": {
          "200": {
            "description": "A page of per-post analytics.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data",
                    "page",
                    "meta"
                  ],
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "additionalProperties": true
                      }
                    },
                    "page": {
                      "$ref": "#/components/schemas/PageMeta"
                    },
                    "meta": {
                      "$ref": "#/components/schemas/ResponseMeta"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Problem"
          },
          "401": {
            "$ref": "#/components/responses/Problem"
          },
          "403": {
            "$ref": "#/components/responses/Problem"
          },
          "404": {
            "$ref": "#/components/responses/Problem"
          },
          "422": {
            "$ref": "#/components/responses/Problem"
          },
          "429": {
            "$ref": "#/components/responses/Problem"
          }
        }
      }
    },
    "/analytics/posts/{id}": {
      "get": {
        "tags": [
          "Analytics"
        ],
        "summary": "Per-post breakdown",
        "description": "Requires the `analytics.read` scope.",
        "operationId": "analyticsPost",
        "x-required-scope": "analytics.read",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdPath"
          }
        ],
        "security": [
          {
            "ApiKey": []
          },
          {
            "OAuth2": [
              "analytics.read"
            ]
          }
        ],
        "responses": {
          "200": {
            "description": "One post, broken down by target.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data",
                    "meta"
                  ],
                  "properties": {
                    "data": {
                      "type": "object",
                      "additionalProperties": true
                    },
                    "meta": {
                      "$ref": "#/components/schemas/ResponseMeta"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Problem"
          },
          "401": {
            "$ref": "#/components/responses/Problem"
          },
          "403": {
            "$ref": "#/components/responses/Problem"
          },
          "404": {
            "$ref": "#/components/responses/Problem"
          },
          "422": {
            "$ref": "#/components/responses/Problem"
          },
          "429": {
            "$ref": "#/components/responses/Problem"
          }
        }
      }
    },
    "/analytics/accounts/{id}": {
      "get": {
        "tags": [
          "Analytics"
        ],
        "summary": "Per-account analytics",
        "description": "Requires the `analytics.read` scope.",
        "operationId": "analyticsAccount",
        "x-required-scope": "analytics.read",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdPath"
          }
        ],
        "security": [
          {
            "ApiKey": []
          },
          {
            "OAuth2": [
              "analytics.read"
            ]
          }
        ],
        "responses": {
          "200": {
            "description": "One account's rollup + series.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data",
                    "meta"
                  ],
                  "properties": {
                    "data": {
                      "type": "object",
                      "additionalProperties": true
                    },
                    "meta": {
                      "$ref": "#/components/schemas/ResponseMeta"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Problem"
          },
          "401": {
            "$ref": "#/components/responses/Problem"
          },
          "403": {
            "$ref": "#/components/responses/Problem"
          },
          "404": {
            "$ref": "#/components/responses/Problem"
          },
          "422": {
            "$ref": "#/components/responses/Problem"
          },
          "429": {
            "$ref": "#/components/responses/Problem"
          }
        }
      }
    },
    "/analytics/clients/{id}": {
      "get": {
        "tags": [
          "Analytics"
        ],
        "summary": "Per-client analytics",
        "description": "Requires the `analytics.read` scope.",
        "operationId": "analyticsClient",
        "x-required-scope": "analytics.read",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdPath"
          }
        ],
        "security": [
          {
            "ApiKey": []
          },
          {
            "OAuth2": [
              "analytics.read"
            ]
          }
        ],
        "responses": {
          "200": {
            "description": "One client's rollup + byPlatform + series.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data",
                    "meta"
                  ],
                  "properties": {
                    "data": {
                      "type": "object",
                      "additionalProperties": true
                    },
                    "meta": {
                      "$ref": "#/components/schemas/ResponseMeta"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Problem"
          },
          "401": {
            "$ref": "#/components/responses/Problem"
          },
          "403": {
            "$ref": "#/components/responses/Problem"
          },
          "404": {
            "$ref": "#/components/responses/Problem"
          },
          "422": {
            "$ref": "#/components/responses/Problem"
          },
          "429": {
            "$ref": "#/components/responses/Problem"
          }
        }
      }
    },
    "/reports": {
      "get": {
        "tags": [
          "Reports"
        ],
        "summary": "List reports",
        "description": "Requires the `reports.read` scope.",
        "operationId": "listReports",
        "x-required-scope": "reports.read",
        "parameters": [
          {
            "$ref": "#/components/parameters/Cursor"
          },
          {
            "$ref": "#/components/parameters/Limit"
          }
        ],
        "security": [
          {
            "ApiKey": []
          },
          {
            "OAuth2": [
              "reports.read"
            ]
          }
        ],
        "responses": {
          "200": {
            "description": "A page of report definitions.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data",
                    "page",
                    "meta"
                  ],
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "additionalProperties": true
                      }
                    },
                    "page": {
                      "$ref": "#/components/schemas/PageMeta"
                    },
                    "meta": {
                      "$ref": "#/components/schemas/ResponseMeta"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Problem"
          },
          "401": {
            "$ref": "#/components/responses/Problem"
          },
          "403": {
            "$ref": "#/components/responses/Problem"
          },
          "404": {
            "$ref": "#/components/responses/Problem"
          },
          "422": {
            "$ref": "#/components/responses/Problem"
          },
          "429": {
            "$ref": "#/components/responses/Problem"
          }
        }
      }
    },
    "/reports/{id}": {
      "get": {
        "tags": [
          "Reports"
        ],
        "summary": "Get a report",
        "description": "Requires the `reports.read` scope.",
        "operationId": "getReport",
        "x-required-scope": "reports.read",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdPath"
          }
        ],
        "security": [
          {
            "ApiKey": []
          },
          {
            "OAuth2": [
              "reports.read"
            ]
          }
        ],
        "responses": {
          "200": {
            "description": "The report + its runs.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data",
                    "meta"
                  ],
                  "properties": {
                    "data": {
                      "type": "object",
                      "additionalProperties": true
                    },
                    "meta": {
                      "$ref": "#/components/schemas/ResponseMeta"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Problem"
          },
          "401": {
            "$ref": "#/components/responses/Problem"
          },
          "403": {
            "$ref": "#/components/responses/Problem"
          },
          "404": {
            "$ref": "#/components/responses/Problem"
          },
          "422": {
            "$ref": "#/components/responses/Problem"
          },
          "429": {
            "$ref": "#/components/responses/Problem"
          }
        }
      }
    },
    "/reports/{id}/exports/{runId}": {
      "get": {
        "tags": [
          "Reports"
        ],
        "summary": "Download a report run",
        "description": "Requires the `reports.read` scope.",
        "operationId": "getReportExport",
        "x-required-scope": "reports.read",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdPath"
          },
          {
            "name": "runId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "security": [
          {
            "ApiKey": []
          },
          {
            "OAuth2": [
              "reports.read"
            ]
          }
        ],
        "responses": {
          "200": {
            "description": "A presigned download for the run.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data",
                    "meta"
                  ],
                  "properties": {
                    "data": {
                      "type": "object",
                      "additionalProperties": true
                    },
                    "meta": {
                      "$ref": "#/components/schemas/ResponseMeta"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Problem"
          },
          "401": {
            "$ref": "#/components/responses/Problem"
          },
          "403": {
            "$ref": "#/components/responses/Problem"
          },
          "404": {
            "$ref": "#/components/responses/Problem"
          },
          "422": {
            "$ref": "#/components/responses/Problem"
          },
          "429": {
            "$ref": "#/components/responses/Problem"
          }
        }
      }
    },
    "/best-times": {
      "get": {
        "tags": [
          "Best times"
        ],
        "summary": "Best-time recommendations",
        "description": "Requires the `besttimes.read` scope.",
        "operationId": "bestTimes",
        "x-required-scope": "besttimes.read",
        "parameters": [
          {
            "name": "clientId",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "platform",
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "ApiKey": []
          },
          {
            "OAuth2": [
              "besttimes.read"
            ]
          }
        ],
        "responses": {
          "200": {
            "description": "Strongest-first posting slots.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data",
                    "meta"
                  ],
                  "properties": {
                    "data": {
                      "type": "object",
                      "additionalProperties": true
                    },
                    "meta": {
                      "$ref": "#/components/schemas/ResponseMeta"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Problem"
          },
          "401": {
            "$ref": "#/components/responses/Problem"
          },
          "403": {
            "$ref": "#/components/responses/Problem"
          },
          "404": {
            "$ref": "#/components/responses/Problem"
          },
          "422": {
            "$ref": "#/components/responses/Problem"
          },
          "429": {
            "$ref": "#/components/responses/Problem"
          }
        }
      }
    },
    "/media": {
      "get": {
        "tags": [
          "Media"
        ],
        "summary": "List library assets",
        "description": "Requires the `media.read` scope.",
        "operationId": "listMedia",
        "x-required-scope": "media.read",
        "parameters": [
          {
            "$ref": "#/components/parameters/Cursor"
          },
          {
            "$ref": "#/components/parameters/Limit"
          },
          {
            "name": "kind",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "image",
                "video",
                "gif",
                "document"
              ]
            }
          },
          {
            "name": "folder",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "clientId",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "search",
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "ApiKey": []
          },
          {
            "OAuth2": [
              "media.read"
            ]
          }
        ],
        "responses": {
          "200": {
            "description": "A page of media assets.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data",
                    "page",
                    "meta"
                  ],
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "additionalProperties": true
                      }
                    },
                    "page": {
                      "$ref": "#/components/schemas/PageMeta"
                    },
                    "meta": {
                      "$ref": "#/components/schemas/ResponseMeta"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Problem"
          },
          "401": {
            "$ref": "#/components/responses/Problem"
          },
          "403": {
            "$ref": "#/components/responses/Problem"
          },
          "404": {
            "$ref": "#/components/responses/Problem"
          },
          "422": {
            "$ref": "#/components/responses/Problem"
          },
          "429": {
            "$ref": "#/components/responses/Problem"
          }
        }
      },
      "post": {
        "tags": [
          "Media"
        ],
        "summary": "Register an uploaded asset",
        "description": "Register an asset that was uploaded to a presigned URL. Requires the `media.manage` scope and an `Idempotency-Key` header.",
        "operationId": "registerMedia",
        "x-required-scope": "media.manage",
        "security": [
          {
            "ApiKey": []
          },
          {
            "OAuth2": [
              "media.manage"
            ]
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": true
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The registered asset.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data",
                    "meta"
                  ],
                  "properties": {
                    "data": {
                      "type": "object",
                      "additionalProperties": true
                    },
                    "meta": {
                      "$ref": "#/components/schemas/ResponseMeta"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Problem"
          },
          "401": {
            "$ref": "#/components/responses/Problem"
          },
          "403": {
            "$ref": "#/components/responses/Problem"
          },
          "404": {
            "$ref": "#/components/responses/Problem"
          },
          "422": {
            "$ref": "#/components/responses/Problem"
          },
          "429": {
            "$ref": "#/components/responses/Problem"
          }
        }
      }
    },
    "/media/{id}": {
      "get": {
        "tags": [
          "Media"
        ],
        "summary": "Get a library asset",
        "description": "Requires the `media.read` scope.",
        "operationId": "getMedia",
        "x-required-scope": "media.read",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdPath"
          }
        ],
        "security": [
          {
            "ApiKey": []
          },
          {
            "OAuth2": [
              "media.read"
            ]
          }
        ],
        "responses": {
          "200": {
            "description": "The media asset.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data",
                    "meta"
                  ],
                  "properties": {
                    "data": {
                      "type": "object",
                      "additionalProperties": true
                    },
                    "meta": {
                      "$ref": "#/components/schemas/ResponseMeta"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Problem"
          },
          "401": {
            "$ref": "#/components/responses/Problem"
          },
          "403": {
            "$ref": "#/components/responses/Problem"
          },
          "404": {
            "$ref": "#/components/responses/Problem"
          },
          "422": {
            "$ref": "#/components/responses/Problem"
          },
          "429": {
            "$ref": "#/components/responses/Problem"
          }
        }
      }
    },
    "/media/presign": {
      "post": {
        "tags": [
          "Media"
        ],
        "summary": "Presign a direct upload",
        "description": "Get a presigned URL to upload a file directly to storage. Requires the `media.manage` scope.",
        "operationId": "presignMedia",
        "x-required-scope": "media.manage",
        "security": [
          {
            "ApiKey": []
          },
          {
            "OAuth2": [
              "media.manage"
            ]
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": true
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The presigned upload.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data",
                    "meta"
                  ],
                  "properties": {
                    "data": {
                      "type": "object",
                      "additionalProperties": true
                    },
                    "meta": {
                      "$ref": "#/components/schemas/ResponseMeta"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Problem"
          },
          "401": {
            "$ref": "#/components/responses/Problem"
          },
          "403": {
            "$ref": "#/components/responses/Problem"
          },
          "404": {
            "$ref": "#/components/responses/Problem"
          },
          "422": {
            "$ref": "#/components/responses/Problem"
          },
          "429": {
            "$ref": "#/components/responses/Problem"
          }
        }
      }
    },
    "/media/import-url": {
      "post": {
        "tags": [
          "Media"
        ],
        "summary": "Import an asset from a URL",
        "description": "Ingest an external image/video into the library by URL. Requires the `media.manage` scope and an `Idempotency-Key` header.",
        "operationId": "importMedia",
        "x-required-scope": "media.manage",
        "security": [
          {
            "ApiKey": []
          },
          {
            "OAuth2": [
              "media.manage"
            ]
          }
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "url"
                ],
                "properties": {
                  "url": {
                    "type": "string",
                    "format": "uri"
                  }
                },
                "additionalProperties": true
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The imported asset.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data",
                    "meta"
                  ],
                  "properties": {
                    "data": {
                      "type": "object",
                      "additionalProperties": true
                    },
                    "meta": {
                      "$ref": "#/components/schemas/ResponseMeta"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Problem"
          },
          "401": {
            "$ref": "#/components/responses/Problem"
          },
          "403": {
            "$ref": "#/components/responses/Problem"
          },
          "404": {
            "$ref": "#/components/responses/Problem"
          },
          "422": {
            "$ref": "#/components/responses/Problem"
          },
          "429": {
            "$ref": "#/components/responses/Problem"
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "ApiKey": {
        "type": "http",
        "scheme": "bearer",
        "description": "A Developer API key (`sked_live_…` / `sked_test_…`) sent as `Authorization: Bearer sked_…`."
      },
      "OAuth2": {
        "type": "oauth2",
        "description": "OAuth 2.1 Authorization Code + PKCE for third-party apps and AI agents.",
        "flows": {
          "authorizationCode": {
            "authorizationUrl": "https://api.skedcast.com/oauth/authorize",
            "tokenUrl": "https://api.skedcast.com/oauth/token",
            "scopes": {
              "agency.read": "Read workspace profile",
              "clients.read": "Read clients",
              "accounts.read": "Read connected social accounts",
              "posts.read": "Read posts and schedule",
              "analytics.read": "Read analytics",
              "reports.read": "Read reports",
              "besttimes.read": "Read best-time recommendations",
              "media.read": "Read content library",
              "posts.compose": "Create and schedule posts",
              "media.manage": "Upload and manage library assets"
            }
          }
        }
      }
    },
    "parameters": {
      "Cursor": {
        "name": "cursor",
        "in": "query",
        "description": "Keyset cursor from a previous page.",
        "schema": {
          "type": "string"
        }
      },
      "Limit": {
        "name": "limit",
        "in": "query",
        "description": "Page size (1–100).",
        "schema": {
          "type": "integer",
          "minimum": 1,
          "maximum": 100
        }
      },
      "IdPath": {
        "name": "id",
        "in": "path",
        "required": true,
        "schema": {
          "type": "string",
          "format": "uuid"
        }
      },
      "IdempotencyKey": {
        "name": "Idempotency-Key",
        "in": "header",
        "required": true,
        "description": "Unique key that dedupes retries of this mutation.",
        "schema": {
          "type": "string"
        }
      },
      "From": {
        "name": "from",
        "in": "query",
        "description": "Window start (YYYY-MM-DD).",
        "schema": {
          "type": "string",
          "format": "date"
        }
      },
      "To": {
        "name": "to",
        "in": "query",
        "description": "Window end (YYYY-MM-DD).",
        "schema": {
          "type": "string",
          "format": "date"
        }
      }
    },
    "schemas": {
      "ResponseMeta": {
        "type": "object",
        "required": [
          "correlationId"
        ],
        "properties": {
          "correlationId": {
            "type": "string",
            "description": "Request trace id."
          }
        }
      },
      "PageMeta": {
        "type": "object",
        "required": [
          "hasMore"
        ],
        "properties": {
          "cursor": {
            "type": [
              "string",
              "null"
            ]
          },
          "nextCursor": {
            "type": [
              "string",
              "null"
            ],
            "description": "Pass as `cursor` to fetch the next page."
          },
          "hasMore": {
            "type": "boolean"
          }
        }
      },
      "ProblemDetails": {
        "type": "object",
        "description": "RFC 9457 problem+json error.",
        "required": [
          "type",
          "title",
          "status",
          "code",
          "correlationId"
        ],
        "properties": {
          "type": {
            "type": "string",
            "format": "uri"
          },
          "title": {
            "type": "string"
          },
          "status": {
            "type": "integer"
          },
          "category": {
            "type": "string"
          },
          "code": {
            "type": "string",
            "description": "Stable machine-readable error code — branch on this."
          },
          "detail": {
            "type": "string"
          },
          "instance": {
            "type": "string"
          },
          "correlationId": {
            "type": "string"
          },
          "errors": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "path": {
                  "type": "string"
                },
                "message": {
                  "type": "string"
                }
              }
            }
          }
        }
      }
    },
    "responses": {
      "Problem": {
        "description": "An RFC 9457 error (`application/problem+json`). The HTTP status carries the class; `code` is the stable identifier.",
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/ProblemDetails"
            }
          }
        }
      }
    }
  }
}