{
  "openapi": "3.1.0",
  "info": {
    "title": "Refract API",
    "version": "1",
    "summary": "Draft, approve, schedule and publish social media posts from your own code.",
    "description": "The public Refract API. JSON:API documents (`application/vnd.api+json`), except the WordPress, notes and versions endpoints, which take and return plain JSON. Every error is a JSON:API error document. A token acts with its role in each workspace (Editor, Contributor, Viewer) and the same approvals as the team. 120 requests a minute per token, 30 for uploads. Full guide: https://refract.social/docs/api. AI apps can use the hosted MCP server instead: https://refract.social/docs/mcp.",
    "contact": {
      "name": "Refract support",
      "url": "https://refract.social/docs/api"
    }
  },
  "servers": [
    {
      "url": "/api/v1"
    }
  ],
  "security": [
    {
      "bearer": []
    }
  ],
  "externalDocs": {
    "description": "API reference",
    "url": "https://refract.social/docs/api"
  },
  "tags": [
    {
      "name": "Me"
    },
    {
      "name": "Networks"
    },
    {
      "name": "Workspaces"
    },
    {
      "name": "WordPress sites"
    },
    {
      "name": "Notes"
    },
    {
      "name": "Versions"
    },
    {
      "name": "Posts"
    },
    {
      "name": "Media"
    }
  ],
  "paths": {
    "/me": {
      "get": {
        "operationId": "getMe",
        "summary": "Who the token acts for",
        "description": "The person, the token or OAuth sign-in with its organization, plan and role or capability, and the AI credits the person can spend.",
        "tags": [
          "Me"
        ],
        "responses": {
          "200": {
            "description": "The person.",
            "content": {
              "application/vnd.api+json": {
                "schema": {
                  "$ref": "#/components/schemas/Me"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthenticated"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/me/token": {
      "delete": {
        "operationId": "revokeToken",
        "summary": "Sign out",
        "description": "Revokes this OAuth access token and its refresh token. API tokens are revoked in Settings and answer 403 here.",
        "tags": [
          "Me"
        ],
        "responses": {
          "204": {
            "description": "Signed out."
          },
          "401": {
            "$ref": "#/components/responses/Unauthenticated"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/networks": {
      "get": {
        "operationId": "listNetworks",
        "summary": "List networks",
        "description": "Every network in Refract's order, with its availability, limits, extra post fields and what Refract can do there.",
        "tags": [
          "Networks"
        ],
        "responses": {
          "200": {
            "description": "The networks.",
            "content": {
              "application/vnd.api+json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Network"
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthenticated"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/workspaces": {
      "get": {
        "operationId": "listWorkspaces",
        "summary": "List workspaces",
        "description": "The workspaces the token can reach. A workspace is one brand with its own accounts.",
        "tags": [
          "Workspaces"
        ],
        "responses": {
          "200": {
            "description": "The workspaces.",
            "content": {
              "application/vnd.api+json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Workspace"
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthenticated"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/workspaces/{workspace}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/workspace"
        }
      ],
      "get": {
        "operationId": "getWorkspace",
        "summary": "Get a workspace",
        "description": "One workspace, with the token's role in it and the language its posts are written in.",
        "tags": [
          "Workspaces"
        ],
        "responses": {
          "200": {
            "description": "The workspace.",
            "content": {
              "application/vnd.api+json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/Workspace"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthenticated"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/workspaces/{workspace}/accounts": {
      "parameters": [
        {
          "$ref": "#/components/parameters/workspace"
        }
      ],
      "get": {
        "operationId": "listAccounts",
        "summary": "List accounts",
        "description": "The workspace's connected social accounts, where posts can go.",
        "tags": [
          "Workspaces"
        ],
        "responses": {
          "200": {
            "description": "The accounts.",
            "content": {
              "application/vnd.api+json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Account"
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthenticated"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/workspaces/{workspace}/accounts/wordpress": {
      "parameters": [
        {
          "$ref": "#/components/parameters/workspace"
        }
      ],
      "post": {
        "operationId": "connectWordPressSite",
        "summary": "Connect a WordPress site",
        "description": "Used by the Refract WordPress plugin to connect its site as an account. Refract checks the site with a signed request first. Editor or Admin.",
        "tags": [
          "WordPress sites"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "site_url",
                  "site_name",
                  "rest_url",
                  "signing_secret",
                  "events_url"
                ],
                "properties": {
                  "site_url": {
                    "type": "string",
                    "format": "uri"
                  },
                  "site_name": {
                    "type": "string",
                    "maxLength": 255
                  },
                  "rest_url": {
                    "type": "string",
                    "format": "uri"
                  },
                  "plugin_version": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "wp_version": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "locale": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "timezone": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "signing_secret": {
                    "type": "string",
                    "description": "Signs the webhook events sent to `events_url`.",
                    "minLength": 32,
                    "maxLength": 255
                  },
                  "events_url": {
                    "type": "string",
                    "format": "uri"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The same site connected again.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WordPressSite"
                }
              }
            }
          },
          "201": {
            "description": "A new site.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WordPressSite"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthenticated"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "422": {
            "description": "Invalid, or the site can't connect: `site_unreachable`, `rest_blocked`, `not_https` or `plan_full`.",
            "content": {
              "application/vnd.api+json": {
                "schema": {
                  "$ref": "#/components/schemas/Errors"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/workspaces/{workspace}/accounts/wordpress/{account}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/workspace"
        },
        {
          "$ref": "#/components/parameters/account"
        }
      ],
      "delete": {
        "operationId": "disconnectWordPressSite",
        "summary": "Remove a WordPress site",
        "description": "Removes the site like Disconnect on the Accounts page, deletes its webhook endpoint and revokes the sign-in or token that connected it. Accounts that aren't WordPress sites answer 404.",
        "tags": [
          "WordPress sites"
        ],
        "responses": {
          "204": {
            "description": "Removed."
          },
          "401": {
            "$ref": "#/components/responses/Unauthenticated"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/workspaces/{workspace}/notes": {
      "parameters": [
        {
          "$ref": "#/components/parameters/workspace"
        }
      ],
      "post": {
        "operationId": "createNoteDraft",
        "summary": "Start a draft from a blog post",
        "description": "Refract writes a version for each account's network from the note, in the workspace's voice, for 1 AI credit each, in the background. Nothing is scheduled: every version waits for approval. Contributor.",
        "tags": [
          "Notes"
        ],
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "maxLength": 255
            },
            "description": "The same key in the workspace returns the first answer (with `Idempotent-Replayed: true`) instead of making a second post."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "source",
                  "accounts"
                ],
                "properties": {
                  "source": {
                    "type": "object",
                    "required": [
                      "type",
                      "account_id",
                      "external_id",
                      "url"
                    ],
                    "properties": {
                      "type": {
                        "const": "wordpress"
                      },
                      "account_id": {
                        "type": "string",
                        "description": "A WordPress site connected to the workspace.",
                        "format": "uuid"
                      },
                      "external_id": {
                        "type": "string",
                        "description": "The blog post's id on the site.",
                        "maxLength": 255
                      },
                      "url": {
                        "type": "string",
                        "format": "uri",
                        "maxLength": 2048
                      },
                      "title": {
                        "type": [
                          "string",
                          "null"
                        ],
                        "maxLength": 1000
                      },
                      "excerpt": {
                        "type": [
                          "string",
                          "null"
                        ]
                      },
                      "text": {
                        "type": [
                          "string",
                          "null"
                        ]
                      }
                    }
                  },
                  "note": {
                    "type": [
                      "object",
                      "null"
                    ],
                    "description": "Empty fields are filled from the blog post.",
                    "properties": {
                      "point": {
                        "type": [
                          "string",
                          "null"
                        ]
                      },
                      "detail": {
                        "type": [
                          "string",
                          "null"
                        ]
                      },
                      "todo": {
                        "type": [
                          "string",
                          "null"
                        ]
                      }
                    }
                  },
                  "start_from": {
                    "type": "string",
                    "description": "`finished` posts the same text everywhere and costs nothing.",
                    "enum": [
                      "note",
                      "finished"
                    ],
                    "default": "note"
                  },
                  "accounts": {
                    "type": "array",
                    "minItems": 1,
                    "items": {
                      "type": "string"
                    },
                    "description": "Account ids in the workspace, never the site itself."
                  },
                  "media": {
                    "type": "array",
                    "maxItems": 10,
                    "items": {
                      "type": "object",
                      "required": [
                        "url"
                      ],
                      "properties": {
                        "url": {
                          "type": "string",
                          "format": "uri"
                        },
                        "alt": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "role": {
                          "type": "string",
                          "enum": [
                            "featured",
                            "content"
                          ]
                        }
                      }
                    }
                  },
                  "images": {
                    "type": "string",
                    "description": "`crop_or_make` makes an image in Studio, for credits, for a network no file fits.",
                    "enum": [
                      "crop",
                      "crop_or_make"
                    ],
                    "default": "crop"
                  },
                  "write": {
                    "type": "boolean",
                    "default": true,
                    "description": "`false` saves the draft and note without writing versions."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "The draft; versions are written in the background.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/NoteAnswer"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthenticated"
          },
          "402": {
            "$ref": "#/components/responses/OutOfCredits"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "422": {
            "$ref": "#/components/responses/Invalid"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/workspaces/{workspace}/notes/{post}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/workspace"
        },
        {
          "$ref": "#/components/parameters/post"
        }
      ],
      "patch": {
        "operationId": "updateNote",
        "summary": "Update a note",
        "description": "After the blog post changed: saves the note and writes again the versions nobody edited; edited ones are marked to check. All need approving again.",
        "tags": [
          "Notes"
        ],
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 255
            },
            "description": "The same key in the workspace returns the first answer (with `Idempotent-Replayed: true`) instead of making a second post."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "source"
                ],
                "properties": {
                  "source": {
                    "type": "object",
                    "required": [
                      "type",
                      "account_id",
                      "external_id",
                      "url"
                    ],
                    "properties": {
                      "type": {
                        "const": "wordpress"
                      },
                      "account_id": {
                        "type": "string",
                        "description": "The site the post came from.",
                        "format": "uuid"
                      },
                      "external_id": {
                        "type": "string",
                        "description": "The blog post's id on the site.",
                        "maxLength": 255
                      },
                      "url": {
                        "type": "string",
                        "format": "uri",
                        "maxLength": 2048
                      },
                      "title": {
                        "type": [
                          "string",
                          "null"
                        ],
                        "maxLength": 1000
                      },
                      "excerpt": {
                        "type": [
                          "string",
                          "null"
                        ]
                      },
                      "text": {
                        "type": [
                          "string",
                          "null"
                        ]
                      }
                    }
                  },
                  "note": {
                    "type": [
                      "object",
                      "null"
                    ],
                    "description": "Empty fields are filled from the blog post.",
                    "properties": {
                      "point": {
                        "type": [
                          "string",
                          "null"
                        ]
                      },
                      "detail": {
                        "type": [
                          "string",
                          "null"
                        ]
                      },
                      "todo": {
                        "type": [
                          "string",
                          "null"
                        ]
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "The draft.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/NoteAnswer"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthenticated"
          },
          "402": {
            "$ref": "#/components/responses/OutOfCredits"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/Invalid"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/workspaces/{workspace}/notes/{post}/visibility": {
      "parameters": [
        {
          "$ref": "#/components/parameters/workspace"
        },
        {
          "$ref": "#/components/parameters/post"
        }
      ],
      "post": {
        "operationId": "setNoteVisibility",
        "summary": "Say whether the blog post is public",
        "description": "Anything but `publish` holds the post: nothing goes out and it can't be scheduled. `publish` ends the hold, and the versions need approving again.",
        "tags": [
          "Notes"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "account_id",
                  "status"
                ],
                "properties": {
                  "account_id": {
                    "type": "string",
                    "description": "The site the post came from."
                  },
                  "status": {
                    "type": "string",
                    "enum": [
                      "publish",
                      "draft",
                      "pending",
                      "private",
                      "future",
                      "password",
                      "trash",
                      "deleted"
                    ]
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Where the post stands.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "post_id": {
                      "type": "string"
                    },
                    "status": {
                      "type": "string"
                    },
                    "public": {
                      "type": "boolean"
                    },
                    "held": {
                      "type": "boolean",
                      "description": "Something waiting to go out is held now."
                    },
                    "needs_ok": {
                      "type": "boolean",
                      "description": "A hold just ended."
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthenticated"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "422": {
            "$ref": "#/components/responses/Invalid"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/workspaces/{workspace}/posts": {
      "parameters": [
        {
          "$ref": "#/components/parameters/workspace"
        }
      ],
      "get": {
        "operationId": "listPosts",
        "summary": "List posts",
        "description": "The workspace's posts, newest first, paginated.",
        "tags": [
          "Posts"
        ],
        "parameters": [
          {
            "name": "filter[status]",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "Comma-separated: draft, awaiting_approval, scheduled, publishing, published, failed.",
            "example": "draft,scheduled"
          },
          {
            "name": "page[number]",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "default": 1
            }
          },
          {
            "name": "page[size]",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 25
            }
          },
          {
            "$ref": "#/components/parameters/include"
          }
        ],
        "responses": {
          "200": {
            "description": "A page of posts.",
            "content": {
              "application/vnd.api+json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Post"
                      }
                    },
                    "included": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Media"
                      }
                    },
                    "links": {
                      "type": "object"
                    },
                    "meta": {
                      "type": "object"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthenticated"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "422": {
            "$ref": "#/components/responses/Invalid"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      },
      "post": {
        "operationId": "createPost",
        "summary": "Create a draft",
        "description": "Saves a draft with `source: api`. Schedule it with schedulePost. Contributor.",
        "tags": [
          "Posts"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/vnd.api+json": {
              "schema": {
                "type": "object",
                "required": [
                  "data"
                ],
                "properties": {
                  "data": {
                    "type": "object",
                    "required": [
                      "type",
                      "attributes"
                    ],
                    "properties": {
                      "type": {
                        "const": "posts"
                      },
                      "attributes": {
                        "type": "object",
                        "required": [
                          "accounts"
                        ],
                        "properties": {
                          "text": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "accounts": {
                            "type": "array",
                            "minItems": 1,
                            "items": {
                              "type": "string"
                            },
                            "description": "Account ids in the workspace."
                          },
                          "media": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            },
                            "description": "Media ids from uploadMedia, in order."
                          },
                          "variants": {
                            "type": "object",
                            "additionalProperties": {
                              "oneOf": [
                                {
                                  "type": "string",
                                  "description": "The platform's text."
                                },
                                {
                                  "type": "object",
                                  "properties": {
                                    "text": {
                                      "type": [
                                        "string",
                                        "null"
                                      ]
                                    },
                                    "settings": {
                                      "$ref": "#/components/schemas/Settings"
                                    },
                                    "skipped_media": {
                                      "type": "array",
                                      "items": {
                                        "type": "string"
                                      },
                                      "description": "Ids of the post's files this network leaves off."
                                    }
                                  }
                                }
                              ]
                            },
                            "description": "Per platform key: its own text, settings or files it leaves off."
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The draft.",
            "headers": {
              "Location": {
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/vnd.api+json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/Post"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthenticated"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "422": {
            "$ref": "#/components/responses/Invalid"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/workspaces/{workspace}/posts/{post}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/workspace"
        },
        {
          "$ref": "#/components/parameters/post"
        }
      ],
      "get": {
        "operationId": "getPost",
        "summary": "Get a post",
        "description": "One post with its accounts, their status, permalinks and errors.",
        "tags": [
          "Posts"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/include"
          }
        ],
        "responses": {
          "200": {
            "description": "The post.",
            "content": {
              "application/vnd.api+json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/Post"
                    },
                    "included": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Media"
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthenticated"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      },
      "delete": {
        "operationId": "deletePost",
        "summary": "Delete a post",
        "description": "Published posts leave Refract but stay on the networks. Contributors can delete only their own drafts and posts waiting for approval.",
        "tags": [
          "Posts"
        ],
        "responses": {
          "204": {
            "description": "Deleted."
          },
          "401": {
            "$ref": "#/components/responses/Unauthenticated"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/workspaces/{workspace}/posts/{post}/schedule": {
      "parameters": [
        {
          "$ref": "#/components/parameters/workspace"
        },
        {
          "$ref": "#/components/parameters/post"
        }
      ],
      "post": {
        "operationId": "schedulePost",
        "summary": "Schedule a post",
        "description": "Runs the composer's checks, then schedules the post, or sends it for approval when the token is a Contributor or the workspace asks for approval from tokens (status `awaiting_approval`). A blocked post answers 422 with one `blocked` error per problem.",
        "tags": [
          "Posts"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/vnd.api+json": {
              "schema": {
                "type": "object",
                "required": [
                  "data"
                ],
                "properties": {
                  "data": {
                    "type": "object",
                    "required": [
                      "type"
                    ],
                    "properties": {
                      "type": {
                        "const": "posts"
                      },
                      "attributes": {
                        "type": "object",
                        "properties": {
                          "when": {
                            "type": "string",
                            "description": "`queue`: the next free posting time; `at`: the time in `at`; `now`: publish right away.",
                            "enum": [
                              "queue",
                              "at",
                              "now"
                            ],
                            "default": "queue"
                          },
                          "at": {
                            "type": "string",
                            "description": "ISO 8601, in the future. Required with `when: at`.",
                            "format": "date-time"
                          },
                          "skip_platforms": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            },
                            "description": "Leave these blocked platforms behind as a new draft (`meta.draft_id`) and schedule the rest."
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The post, scheduled or waiting for approval.",
            "content": {
              "application/vnd.api+json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/Post"
                    },
                    "meta": {
                      "type": "object",
                      "properties": {
                        "message": {
                          "type": "string"
                        },
                        "draft_id": {
                          "type": [
                            "string",
                            "null"
                          ]
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthenticated"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/Invalid"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/workspaces/{workspace}/posts/{post}/accounts/{account}/edit": {
      "parameters": [
        {
          "$ref": "#/components/parameters/workspace"
        },
        {
          "$ref": "#/components/parameters/post"
        },
        {
          "$ref": "#/components/parameters/account"
        }
      ],
      "post": {
        "operationId": "editPublishedPost",
        "summary": "Edit a published post on one account",
        "description": "Changes one account's published copy on its network, where the network allows it. Editor or Admin. The result arrives in the account's `edit` and the `post.edited` webhook.",
        "tags": [
          "Posts"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/vnd.api+json": {
              "schema": {
                "type": "object",
                "required": [
                  "data"
                ],
                "properties": {
                  "data": {
                    "type": "object",
                    "required": [
                      "type",
                      "attributes"
                    ],
                    "properties": {
                      "type": {
                        "const": "posts"
                      },
                      "attributes": {
                        "type": "object",
                        "required": [
                          "text"
                        ],
                        "properties": {
                          "text": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "The whole new text, or null for none where the network allows it."
                          },
                          "settings": {
                            "$ref": "#/components/schemas/Settings"
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The post.",
            "content": {
              "application/vnd.api+json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/Post"
                    },
                    "meta": {
                      "type": "object",
                      "properties": {
                        "message": {
                          "type": "string"
                        },
                        "state": {
                          "type": "string",
                          "enum": [
                            "applying",
                            "approving"
                          ]
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthenticated"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/Invalid"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/workspaces/{workspace}/posts/{post}/accounts/{account}/remove": {
      "parameters": [
        {
          "$ref": "#/components/parameters/workspace"
        },
        {
          "$ref": "#/components/parameters/post"
        },
        {
          "$ref": "#/components/parameters/account"
        }
      ],
      "post": {
        "operationId": "removePublishedPost",
        "summary": "Remove a published post from one account",
        "description": "Takes the account's copy down from its network; it stays in Refract as `removed`. Editor or Admin.",
        "tags": [
          "Posts"
        ],
        "responses": {
          "200": {
            "description": "The post.",
            "content": {
              "application/vnd.api+json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/Post"
                    },
                    "meta": {
                      "type": "object",
                      "properties": {
                        "message": {
                          "type": "string"
                        },
                        "state": {
                          "type": "string",
                          "enum": [
                            "removing",
                            "removed"
                          ]
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthenticated"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/workspaces/{workspace}/posts/{post}/versions": {
      "parameters": [
        {
          "$ref": "#/components/parameters/workspace"
        },
        {
          "$ref": "#/components/parameters/post"
        }
      ],
      "get": {
        "operationId": "listVersions",
        "summary": "List a post's versions",
        "description": "One entry per account, with its text, files, checks and status.",
        "tags": [
          "Versions"
        ],
        "responses": {
          "200": {
            "description": "The versions.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Versions"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthenticated"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/workspaces/{workspace}/posts/{post}/versions/{version}/approve": {
      "parameters": [
        {
          "$ref": "#/components/parameters/workspace"
        },
        {
          "$ref": "#/components/parameters/post"
        },
        {
          "name": "version",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          }
        }
      ],
      "post": {
        "operationId": "approveVersion",
        "summary": "Approve one version",
        "description": "A version still being written, or that couldn't be written, answers 409.",
        "tags": [
          "Versions"
        ],
        "responses": {
          "200": {
            "description": "The versions.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Versions"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthenticated"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/workspaces/{workspace}/posts/{post}/approve-all": {
      "parameters": [
        {
          "$ref": "#/components/parameters/workspace"
        },
        {
          "$ref": "#/components/parameters/post"
        }
      ],
      "post": {
        "operationId": "approveAllVersions",
        "summary": "Approve every version and queue the post",
        "description": "Approves every version that needs an OK and passes its checks, then adds the post to the queue, or sends it for approval when the token can't publish. Blocked networks stay behind as a new draft.",
        "tags": [
          "Versions"
        ],
        "responses": {
          "200": {
            "description": "The versions, and what happened.",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Versions"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "queued": {
                          "type": "boolean"
                        },
                        "waiting_for": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "enum": [
                            "approval",
                            null
                          ]
                        },
                        "skipped": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          },
                          "description": "Versions not approved because of a failing check."
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthenticated"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/workspaces/{workspace}/media": {
      "parameters": [
        {
          "$ref": "#/components/parameters/workspace"
        }
      ],
      "post": {
        "operationId": "uploadMedia",
        "summary": "Upload a file or add one from a link",
        "description": "A file as multipart/form-data, or a public http(s) link Refract downloads. Images up to 50 MB, videos up to 1 GB. Use the returned id in a draft's `media`. 30 uploads a minute.",
        "tags": [
          "Media"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "multipart/form-data": {
              "schema": {
                "type": "object",
                "required": [
                  "file"
                ],
                "properties": {
                  "file": {
                    "type": "string",
                    "contentMediaType": "application/octet-stream"
                  }
                }
              }
            },
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "url"
                ],
                "properties": {
                  "url": {
                    "type": "string",
                    "description": "A public http or https address.",
                    "format": "uri",
                    "maxLength": 2048
                  },
                  "alt": {
                    "type": "string"
                  }
                }
              }
            },
            "application/vnd.api+json": {
              "schema": {
                "type": "object",
                "required": [
                  "data"
                ],
                "properties": {
                  "data": {
                    "type": "object",
                    "required": [
                      "type",
                      "attributes"
                    ],
                    "properties": {
                      "type": {
                        "const": "media"
                      },
                      "attributes": {
                        "type": "object",
                        "required": [
                          "url"
                        ],
                        "properties": {
                          "url": {
                            "type": "string",
                            "format": "uri"
                          },
                          "alt": {
                            "type": "string"
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The file.",
            "content": {
              "application/vnd.api+json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/Media"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthenticated"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "422": {
            "$ref": "#/components/responses/Invalid"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/workspaces/{workspace}/media/{media}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/workspace"
        },
        {
          "name": "media",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          }
        }
      ],
      "get": {
        "operationId": "getMedia",
        "summary": "Get a file",
        "description": "One file from the workspace's library.",
        "tags": [
          "Media"
        ],
        "responses": {
          "200": {
            "description": "The file.",
            "content": {
              "application/vnd.api+json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/Media"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthenticated"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "bearer": {
        "type": "http",
        "scheme": "bearer",
        "description": "An API token (`rf_live_…`, Settings › API and agents) or an OAuth access token with the `api` scope."
      }
    },
    "parameters": {
      "workspace": {
        "name": "workspace",
        "in": "path",
        "required": true,
        "schema": {
          "type": "string"
        },
        "description": "A workspace's id or slug."
      },
      "post": {
        "name": "post",
        "in": "path",
        "required": true,
        "schema": {
          "type": "string"
        }
      },
      "account": {
        "name": "account",
        "in": "path",
        "required": true,
        "schema": {
          "type": "string"
        }
      },
      "include": {
        "name": "include",
        "in": "query",
        "schema": {
          "const": "media"
        },
        "description": "`media` adds the post's files in `included`."
      }
    },
    "schemas": {
      "Errors": {
        "type": "object",
        "required": [
          "errors"
        ],
        "properties": {
          "errors": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "status": {
                  "type": "string"
                },
                "code": {
                  "type": "string",
                  "description": "unauthenticated, out_of_credits, forbidden, not_found, conflict, invalid, blocked, site_unreachable, rest_blocked, not_https, plan_full, too_many_requests"
                },
                "title": {
                  "type": "string"
                },
                "detail": {
                  "type": "string"
                },
                "source": {
                  "type": "object",
                  "properties": {
                    "pointer": {
                      "type": "string",
                      "description": "The attribute, such as /data/attributes/accounts/0."
                    },
                    "parameter": {
                      "type": "string",
                      "description": "The query parameter, such as filter[status]."
                    }
                  }
                },
                "meta": {
                  "type": "object"
                }
              }
            }
          }
        }
      },
      "Me": {
        "type": "object",
        "properties": {
          "data": {
            "type": "object",
            "required": [
              "id",
              "type",
              "attributes"
            ],
            "properties": {
              "id": {
                "type": "string"
              },
              "type": {
                "const": "users"
              },
              "attributes": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string"
                  },
                  "email": {
                    "type": "string"
                  }
                }
              }
            }
          },
          "meta": {
            "type": "object",
            "properties": {
              "access": {
                "type": "object",
                "description": "`kind` token: name and role; `kind` oauth: client, capability and capability_label.",
                "properties": {
                  "kind": {
                    "type": "string",
                    "enum": [
                      "token",
                      "oauth"
                    ]
                  },
                  "name": {
                    "type": "string"
                  },
                  "role": {
                    "type": "string"
                  },
                  "client": {
                    "type": "string"
                  },
                  "capability": {
                    "type": "string"
                  },
                  "capability_label": {
                    "type": "string"
                  },
                  "organization": {
                    "type": "object",
                    "properties": {
                      "id": {
                        "type": "string"
                      },
                      "name": {
                        "type": "string"
                      },
                      "plan": {
                        "type": "string"
                      }
                    }
                  }
                }
              },
              "credits": {
                "type": "object",
                "properties": {
                  "left": {
                    "type": "integer"
                  },
                  "refill_on": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "format": "date"
                  },
                  "own_key": {
                    "type": "boolean"
                  },
                  "buy_url": {
                    "type": "string"
                  }
                }
              }
            }
          }
        }
      },
      "Network": {
        "type": "object",
        "required": [
          "id",
          "type",
          "attributes"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "type": {
            "const": "networks"
          },
          "attributes": {
            "type": "object",
            "properties": {
              "key": {
                "type": "string",
                "description": "The `platform` value accounts and posts use."
              },
              "label": {
                "type": "string"
              },
              "mark_key": {
                "type": "string"
              },
              "aliases": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "group": {
                "type": "string",
                "enum": [
                  "social",
                  "chat",
                  "blogs",
                  "local"
                ]
              },
              "availability": {
                "type": "string",
                "enum": [
                  "available",
                  "beta",
                  "soon",
                  "internal"
                ]
              },
              "capabilities": {
                "type": "object"
              },
              "fields": {
                "type": "object",
                "description": "Extra post fields the network uses, with their limits."
              },
              "limits": {
                "type": "object",
                "properties": {
                  "text_max": {
                    "type": [
                      "integer",
                      "null"
                    ]
                  },
                  "media_max": {
                    "type": [
                      "integer",
                      "null"
                    ]
                  }
                }
              }
            }
          }
        }
      },
      "Workspace": {
        "type": "object",
        "required": [
          "id",
          "type",
          "attributes"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "type": {
            "const": "workspaces"
          },
          "attributes": {
            "type": "object",
            "properties": {
              "name": {
                "type": "string"
              },
              "slug": {
                "type": "string"
              },
              "timezone": {
                "type": "string",
                "description": "Times in posts are in this zone."
              },
              "role": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "The token's role here."
              },
              "posts_need_approval": {
                "type": "boolean"
              },
              "post_language": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "Write the workspace's posts in this language (de, sl, sr-Latn…)."
              }
            }
          }
        }
      },
      "Account": {
        "type": "object",
        "required": [
          "id",
          "type",
          "attributes"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "type": {
            "const": "accounts"
          },
          "attributes": {
            "type": "object",
            "properties": {
              "platform": {
                "type": "string"
              },
              "label": {
                "type": "string"
              },
              "name": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "handle": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "avatar_url": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "health": {
                "type": "string",
                "enum": [
                  "connected",
                  "expiring_soon",
                  "needs_reconnect"
                ]
              },
              "main": {
                "type": "boolean"
              },
              "availability": {
                "type": "string",
                "enum": [
                  "available",
                  "beta",
                  "soon",
                  "internal"
                ]
              }
            }
          }
        }
      },
      "WordPressSite": {
        "type": "object",
        "properties": {
          "account_id": {
            "type": "string"
          },
          "handle": {
            "type": "string"
          },
          "workspace": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "slug": {
                "type": "string"
              },
              "name": {
                "type": "string"
              }
            }
          }
        }
      },
      "NoteAnswer": {
        "type": "object",
        "properties": {
          "post_id": {
            "type": "string"
          },
          "status": {
            "type": "string"
          },
          "start_from": {
            "type": "string",
            "enum": [
              "note",
              "finished"
            ]
          },
          "versions": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "description": "Null for a finished post."
                },
                "account_id": {
                  "type": "string"
                },
                "network": {
                  "type": "string"
                },
                "status": {
                  "type": "string"
                }
              }
            }
          },
          "credits_held": {
            "type": "integer",
            "description": "AI credits set aside for the versions."
          },
          "media_credits": {
            "type": "integer",
            "description": "AI credits set aside for images."
          },
          "media_skipped": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Files no network can take."
          },
          "edit_url": {
            "type": "string",
            "description": "The draft in Refract."
          }
        }
      },
      "Versions": {
        "type": "object",
        "properties": {
          "post_id": {
            "type": "string"
          },
          "post_status": {
            "type": "string"
          },
          "start_from": {
            "type": "string",
            "enum": [
              "note",
              "finished"
            ]
          },
          "source": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "type": {
                "type": "string"
              },
              "account_id": {
                "type": "string"
              },
              "external_id": {
                "type": "string"
              },
              "url": {
                "type": "string"
              },
              "title": {
                "type": [
                  "string",
                  "null"
                ]
              }
            }
          },
          "can_publish": {
            "type": "boolean",
            "description": "False when the token can't publish or the workspace asks for approval from it; `approvers` then names who can approve."
          },
          "approvers": {
            "type": "array",
            "items": {
              "type": "object"
            }
          },
          "edit_url": {
            "type": "string",
            "description": "The post in Refract."
          },
          "versions": {
            "type": "array",
            "description": "One entry per account; accounts on one network share a version id.",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "account": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "network": {
                      "type": "string"
                    },
                    "network_label": {
                      "type": "string"
                    },
                    "name": {
                      "type": "string"
                    },
                    "handle": {
                      "type": "string"
                    },
                    "availability": {
                      "type": "string"
                    },
                    "main": {
                      "type": "boolean"
                    }
                  }
                },
                "status": {
                  "type": "string",
                  "enum": [
                    "writing",
                    "needs_ok",
                    "approved",
                    "edited",
                    "waiting_for_approval",
                    "scheduled",
                    "posted",
                    "failed"
                  ]
                },
                "text": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "title": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "media": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "url": {
                        "type": "string"
                      },
                      "thumb_url": {
                        "type": [
                          "string",
                          "null"
                        ]
                      },
                      "width": {
                        "type": [
                          "integer",
                          "null"
                        ]
                      },
                      "height": {
                        "type": [
                          "integer",
                          "null"
                        ]
                      },
                      "alt": {
                        "type": [
                          "string",
                          "null"
                        ]
                      },
                      "type": {
                        "type": "string"
                      }
                    }
                  }
                },
                "checks": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "level": {
                        "type": "string",
                        "description": "A `fail` check keeps the version from going out.",
                        "enum": [
                          "pass",
                          "warn",
                          "fail"
                        ]
                      },
                      "code": {
                        "type": "string"
                      },
                      "message": {
                        "type": "string"
                      }
                    }
                  }
                },
                "rules_followed": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "id": {
                        "type": "string"
                      },
                      "text": {
                        "type": "string"
                      }
                    }
                  }
                },
                "stale": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "description": "`old`: written before the note changed; `check`: edited, then the note changed.",
                  "enum": [
                    "old",
                    "check",
                    null
                  ]
                },
                "scheduled_for": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "format": "date-time"
                },
                "permalink": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "short_link": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "clicks": {
                  "type": "integer"
                },
                "error": {
                  "type": [
                    "object",
                    "null"
                  ],
                  "properties": {
                    "message": {
                      "type": "string"
                    },
                    "fix": {
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  }
                },
                "approvable": {
                  "type": "boolean"
                },
                "edit_url": {
                  "type": "string"
                }
              }
            }
          }
        }
      },
      "Post": {
        "type": "object",
        "required": [
          "id",
          "type",
          "attributes"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "type": {
            "const": "posts"
          },
          "attributes": {
            "type": "object",
            "properties": {
              "text": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "status": {
                "type": "string",
                "enum": [
                  "draft",
                  "awaiting_approval",
                  "scheduled",
                  "publishing",
                  "published",
                  "failed"
                ]
              },
              "source": {
                "type": "string",
                "description": "`api` for posts made through the API."
              },
              "scheduled_at": {
                "type": [
                  "string",
                  "null"
                ],
                "format": "date-time",
                "description": "In the workspace's time zone."
              },
              "published_at": {
                "type": [
                  "string",
                  "null"
                ],
                "format": "date-time"
              },
              "accounts": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "platform": {
                      "type": "string"
                    },
                    "handle": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "pending",
                        "queued",
                        "uploading",
                        "processing",
                        "published",
                        "failed",
                        "removed"
                      ]
                    },
                    "permalink": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "error": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "removed_at": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "format": "date-time"
                    },
                    "edits_count": {
                      "type": "integer"
                    },
                    "edit": {
                      "type": [
                        "object",
                        "null"
                      ],
                      "description": "The latest edit after publishing.",
                      "properties": {
                        "state": {
                          "type": "string",
                          "enum": [
                            "approving",
                            "applying",
                            "applied",
                            "failed"
                          ]
                        },
                        "text": {
                          "type": "string"
                        },
                        "error": {
                          "type": [
                            "string",
                            "null"
                          ]
                        }
                      }
                    }
                  }
                }
              },
              "variants": {
                "type": "object",
                "additionalProperties": {
                  "type": "string"
                },
                "description": "Per-platform text where it differs from the main text."
              },
              "skipped_media": {
                "type": "object",
                "additionalProperties": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                },
                "description": "Per platform, the ids of the files it leaves off."
              },
              "created_at": {
                "type": "string",
                "format": "date-time"
              },
              "updated_at": {
                "type": "string",
                "format": "date-time"
              }
            }
          },
          "relationships": {
            "type": "object",
            "properties": {
              "media": {
                "type": "object",
                "properties": {
                  "data": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "type": {
                          "const": "media"
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      },
      "Media": {
        "type": "object",
        "required": [
          "id",
          "type",
          "attributes"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "type": {
            "const": "media"
          },
          "attributes": {
            "type": "object",
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "image",
                  "video",
                  "gif"
                ]
              },
              "filename": {
                "type": "string"
              },
              "mime_type": {
                "type": "string"
              },
              "size_bytes": {
                "type": "integer"
              },
              "width": {
                "type": [
                  "integer",
                  "null"
                ]
              },
              "height": {
                "type": [
                  "integer",
                  "null"
                ]
              },
              "duration_ms": {
                "type": [
                  "integer",
                  "null"
                ]
              },
              "alt_text": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "url": {
                "type": "string",
                "description": "Works for a limited time."
              },
              "created_at": {
                "type": "string",
                "format": "date-time"
              }
            }
          }
        }
      },
      "Settings": {
        "type": "object",
        "description": "Extra fields some networks take (GET /networks lists each network's `fields`). A field the network doesn't take answers 422.",
        "properties": {
          "title": {
            "type": "string",
            "description": "Required on some networks (YouTube, DEV)."
          },
          "tags": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Tags without the #."
          },
          "community_id": {
            "type": "string",
            "description": "The community: its id on the account's server, or its address (coffee@lemmy.world)."
          },
          "canonical_url": {
            "type": "string",
            "description": "Where the post first appeared.",
            "format": "uri"
          },
          "as_draft": {
            "type": "boolean",
            "description": "Send to the network's drafts instead of publishing."
          },
          "post_as": {
            "type": "object",
            "properties": {
              "name": {
                "type": "string"
              },
              "avatar_media_id": {
                "type": "string"
              }
            },
            "description": "The name and library picture the post goes out under."
          },
          "privacy_level": {
            "type": "string",
            "description": "TikTok only, required before scheduling. Ask the person; there is no default.",
            "enum": [
              "PUBLIC_TO_EVERYONE",
              "MUTUAL_FOLLOW_FRIENDS",
              "FOLLOWER_OF_CREATOR",
              "SELF_ONLY"
            ]
          }
        }
      }
    },
    "responses": {
      "Unauthenticated": {
        "description": "No token, or it is revoked or expired.",
        "content": {
          "application/vnd.api+json": {
            "schema": {
              "$ref": "#/components/schemas/Errors"
            }
          }
        }
      },
      "OutOfCredits": {
        "description": "Not enough AI credits; nothing was created.",
        "content": {
          "application/vnd.api+json": {
            "schema": {
              "allOf": [
                {
                  "$ref": "#/components/schemas/Errors"
                },
                {
                  "type": "object",
                  "properties": {
                    "needed": {
                      "type": "integer"
                    },
                    "left": {
                      "type": "integer"
                    },
                    "refill_on": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "buy_url": {
                      "type": "string"
                    }
                  }
                }
              ]
            }
          }
        }
      },
      "Forbidden": {
        "description": "The token's role doesn't allow it in this workspace.",
        "content": {
          "application/vnd.api+json": {
            "schema": {
              "$ref": "#/components/schemas/Errors"
            }
          }
        }
      },
      "NotFound": {
        "description": "It doesn't exist, or the token can't reach it.",
        "content": {
          "application/vnd.api+json": {
            "schema": {
              "$ref": "#/components/schemas/Errors"
            }
          }
        }
      },
      "Conflict": {
        "description": "Not possible right now (the post is publishing, say).",
        "content": {
          "application/vnd.api+json": {
            "schema": {
              "$ref": "#/components/schemas/Errors"
            }
          }
        }
      },
      "Invalid": {
        "description": "An attribute isn't valid, or a network blocks the post.",
        "content": {
          "application/vnd.api+json": {
            "schema": {
              "$ref": "#/components/schemas/Errors"
            }
          }
        }
      },
      "TooManyRequests": {
        "description": "Rate limited; wait for Retry-After seconds.",
        "headers": {
          "Retry-After": {
            "schema": {
              "type": "integer"
            }
          }
        },
        "content": {
          "application/vnd.api+json": {
            "schema": {
              "$ref": "#/components/schemas/Errors"
            }
          }
        }
      }
    }
  }
}
