{
  "openapi": "3.0.4",
  "info": {
    "title": "Assisthub REST API",
    "description": "Repurpose content with AI, run single-purpose agents, multi-step pipelines and saved templates. Authenticate AI endpoints with the X-API-Key header. Human-readable reference: /ApiDocs",
    "contact": {
      "name": "Assisthub support",
      "url": "/Contact"
    },
    "version": "1.0.0"
  },
  "servers": [
    {
      "url": "http://assisthub.xyz"
    }
  ],
  "paths": {
    "/api/v1/health": {
      "get": {
        "tags": [
          "System"
        ],
        "summary": "Health check",
        "description": "Service status and provider reachability. Not rate limited.",
        "operationId": "health",
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/api/v1/providers": {
      "get": {
        "tags": [
          "System"
        ],
        "summary": "List providers",
        "description": "List the AI providers, whether each is configured, and whether it is reachable now.",
        "operationId": "providers",
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/api/v1/agents": {
      "get": {
        "tags": [
          "Content"
        ],
        "summary": "List agents",
        "description": "List the single-purpose agent methods you can call with Run an agent.",
        "operationId": "agents",
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/api/v1/generate": {
      "post": {
        "tags": [
          "Content"
        ],
        "summary": "Repurpose content",
        "description": "Rewrite a piece of content for another format and tone. Counts toward the AI rate limit. Successful results are saved to the account's library.",
        "operationId": "generate",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/GenerateRequest"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/GenerateRequest"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/GenerateRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "description": "Missing or invalid API key."
          },
          "429": {
            "description": "Rate limit reached. See the Retry-After header."
          }
        },
        "security": [
          {
            "ApiKey": [ ]
          }
        ]
      }
    },
    "/api/v1/batch": {
      "post": {
        "tags": [
          "Content"
        ],
        "summary": "Repurpose for several channels",
        "description": "Rewrite the same content for up to 8 target formats in one call. Each successful result is saved to the library. Counts toward the AI rate limit. Successful results are saved to the account's library.",
        "operationId": "batch",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/BatchRequest"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/BatchRequest"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/BatchRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "description": "Missing or invalid API key."
          },
          "429": {
            "description": "Rate limit reached. See the Retry-After header."
          }
        },
        "security": [
          {
            "ApiKey": [ ]
          }
        ]
      }
    },
    "/api/v1/agent/{method}": {
      "post": {
        "tags": [
          "Content"
        ],
        "summary": "Run an agent",
        "description": "Run a single-purpose agent such as summarize, seo or hashtags on your content. Counts toward the AI rate limit. Successful results are saved to the account's library.",
        "operationId": "agent",
        "parameters": [
          {
            "name": "method",
            "in": "path",
            "description": "One of the agent methods listed below.",
            "required": true,
            "schema": {
              "enum": [
                "summarize",
                "seo",
                "social",
                "email",
                "blog",
                "adcopy",
                "bullets",
                "title",
                "rewrite",
                "hashtags",
                "questions",
                "sentiment",
                "keywords",
                "grammar",
                "faq",
                "quiz",
                "studyguide"
              ],
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AgentRequest"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/AgentRequest"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/AgentRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "description": "Missing or invalid API key."
          },
          "429": {
            "description": "Rate limit reached. See the Retry-After header."
          }
        },
        "security": [
          {
            "ApiKey": [ ]
          }
        ]
      }
    },
    "/api/v1/pipelines": {
      "get": {
        "tags": [
          "Pipelines"
        ],
        "summary": "List pipelines",
        "description": "List every multi-step pipeline with its id, category and number of steps.",
        "operationId": "pipelines",
        "parameters": [
          {
            "name": "category",
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/api/v1/pipelines/{id}/execute": {
      "post": {
        "tags": [
          "Pipelines"
        ],
        "summary": "Run a pipeline",
        "description": "Run every step of a pipeline on your content. Each step's output feeds the next. Counts toward the AI rate limit. Successful results are saved to the account's library.",
        "operationId": "pipeline-run",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "Pipeline id from List pipelines.",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AgentRequest"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/AgentRequest"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/AgentRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "description": "Missing or invalid API key."
          },
          "429": {
            "description": "Rate limit reached. See the Retry-After header."
          }
        },
        "security": [
          {
            "ApiKey": [ ]
          }
        ]
      }
    },
    "/api/v1/templates": {
      "get": {
        "tags": [
          "Templates"
        ],
        "summary": "List templates",
        "description": "List the saved templates you can apply with Use a template.",
        "operationId": "templates",
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/api/v1/templates/{id}/use": {
      "post": {
        "tags": [
          "Templates"
        ],
        "summary": "Use a template",
        "description": "Apply a saved template's formats, tone and instructions to your content. Counts toward the AI rate limit. Successful results are saved to the account's library.",
        "operationId": "template-use",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "Template id from List templates.",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AgentRequest"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/AgentRequest"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/AgentRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "description": "Missing or invalid API key."
          },
          "429": {
            "description": "Rate limit reached. See the Retry-After header."
          }
        },
        "security": [
          {
            "ApiKey": [ ]
          }
        ]
      }
    },
    "/api/v1/content": {
      "get": {
        "tags": [
          "Library"
        ],
        "summary": "Search the library",
        "description": "List saved content, newest first, with optional search and filters. Returns metadata without the full text.",
        "operationId": "content-list",
        "parameters": [
          {
            "name": "q",
            "in": "query",
            "description": "Words to find in titles, text and tags.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "origin",
            "in": "query",
            "description": "Only items from one source.",
            "schema": {
              "enum": [
                "Repurpose",
                "Batch",
                "Pipeline",
                "Template",
                "Scheduled",
                "API",
                "Agent",
                "Manual"
              ],
              "type": "string"
            }
          },
          {
            "name": "format",
            "in": "query",
            "description": "Only items for one target format, e.g. LinkedIn.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "favorite",
            "in": "query",
            "description": "true for favorites only.",
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "description": "1 to 100. Default: 20.",
            "schema": {
              "type": "integer",
              "format": "int32",
              "default": 20
            }
          },
          {
            "name": "offset",
            "in": "query",
            "description": "Items to skip, for paging. Default: 0.",
            "schema": {
              "type": "integer",
              "format": "int32",
              "default": 0
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "description": "Missing or invalid API key."
          }
        },
        "security": [
          {
            "ApiKey": [ ]
          }
        ]
      }
    },
    "/api/v1/content/{id}": {
      "get": {
        "tags": [
          "Library"
        ],
        "summary": "Get a library item",
        "description": "Get one saved item, including the source text (input) and the generated text (output).",
        "operationId": "content-get",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "Library item id, from a generation response (contentId) or the search results.",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "description": "Missing or invalid API key."
          }
        },
        "security": [
          {
            "ApiKey": [ ]
          }
        ]
      },
      "delete": {
        "tags": [
          "Library"
        ],
        "summary": "Delete a library item",
        "description": "Permanently delete one saved item. Fires the content.deleted webhook.",
        "operationId": "content-delete",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "Library item id.",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "description": "Missing or invalid API key."
          }
        },
        "security": [
          {
            "ApiKey": [ ]
          }
        ]
      }
    }
  },
  "components": {
    "schemas": {
      "AgentRequest": {
        "type": "object",
        "properties": {
          "content": {
            "type": "string",
            "nullable": true
          },
          "provider": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "BatchRequest": {
        "type": "object",
        "properties": {
          "content": {
            "type": "string",
            "nullable": true
          },
          "sourceFormat": {
            "type": "string",
            "nullable": true
          },
          "targetFormats": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "nullable": true
          },
          "tone": {
            "type": "string",
            "nullable": true
          },
          "provider": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "GenerateRequest": {
        "type": "object",
        "properties": {
          "content": {
            "type": "string",
            "nullable": true
          },
          "sourceFormat": {
            "type": "string",
            "nullable": true
          },
          "targetFormat": {
            "type": "string",
            "nullable": true
          },
          "tone": {
            "type": "string",
            "nullable": true
          },
          "provider": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      }
    },
    "securitySchemes": {
      "ApiKey": {
        "type": "apiKey",
        "description": "API key created in Settings > API keys (format: ak_ followed by 40 characters).",
        "name": "X-API-Key",
        "in": "header"
      }
    }
  },
  "tags": [
    {
      "name": "V1"
    },
    {
      "name": "System"
    },
    {
      "name": "Content"
    },
    {
      "name": "Pipelines"
    },
    {
      "name": "Templates"
    },
    {
      "name": "Library"
    }
  ]
}