ScriptGrain Brief templates API

Saved briefs to start the next piece from.

GitHub OpenAPI

Operations 3

GET /v1/brief-templates List brief templates #
POST /v1/brief-templates Save a brief template #
DELETE /v1/brief-templates/{id} Delete a brief template #

Work with this as data

Every API here is available over the APIs.io API and to AI agents over MCP.

MCP server

One button, every client — Claude, Cursor, VS Code and the rest.

https://apis.io/mcp

Tools for apis

7 MCP tools reach this
  • find_apisBrowse and filter every API in the catalog.
  • get_api_artifactsOne API's artifacts, grouped by type.
  • get_openapiThe primary OpenAPI for this API.
  • find_similar_apisAPIs that look like this one.
  • apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.
  • resolveTurn a domain, URL or GitHub org into the provider it belongs to.
  • find_cohortsEvery scored population of providers in the catalog.
All 92 tools →

Call it yourself

curl for this page
This API
curl "https://apis.io/api/v1/apis/scriptgrain-com:scriptgrain-com-brief-templates-api"
All apis
curl "https://apis.io/api/v1/apis?limit=25"

Calls without X-API-Key need no key. Calls with it need a paid plan — get a key.

Get an API key

Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. By signing up you are subscribing to the APIs.io and API Evangelist newsletters — you can unsubscribe from any issue. See our Privacy Policy and Terms.

A second provider on the same verified email joins the account you already have.

OpenAPI Specification

scriptgrain-com-brief-templates-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  title: ScriptGrain Brief templates API
  version: 1.0.0
  summary: Voice profiles, drafts in a measured voice, and scores for any text, over HTTPS with an API key.
  description: 'ScriptGrain measures how a person or brand writes (45 stylometric attributes in eight groups),

    drafts new text in that voice, and scores any text against it. This file describes the public

    REST API, version 1, as the code serves it. It is generated from `public/openapi.yaml` in the

    ScriptGrain repository and checked against the API''s router in CI, so every route listed here

    exists and every error code a handler can return is named below. Human documentation: . The same capabilities are exposed

    as an MCP server at `https://mcp.scriptgrain.com/mcp` (). ## Authentication


    Every request carries an API key: `Authorization: Bearer sg_live_`. Keys are minted in

    the app under Settings, then API, and shown once. A key belongs to an organisation. A personal

    workspace key acts as its owner and sees the owner''s personal-workspace rows. A team key acts as

    the owner or admin who created it, sees only the team''s rows, puts what it creates in the team,

    and stops working (`401 invalid_api_key`) once its creator is no longer a team owner or admin;

    leaving or being removed from the team revokes the member''s keys for that team. API access is

    open on every plan, including Free; a deployment can narrow it (`system_config`

    `api_v1.allowed_plans`), in which case non-billing routes answer `403 plan_not_eligible`. Billing routes (`/v1/billing*`) are never plan-gated. Before any route runs, authentication can also answer `401 unauthorized` (header missing or

    malformed), `401 invalid_api_key` (unknown or revoked key), `403 organisation_missing` (the

    key''s organisation was deleted) or `402 no_subscription` (no billing record resolves). A

    deployment missing its secrets answers `500 misconfigured`. These five are not repeated on each

    operation below. ## Responses


    Successes return the resource directly. Errors return one envelope:


    ```json

    { "error": { "code": "invalid_request", "message": "brief (string) is required." } }

    ```


    Some errors add fields beside `message` (for example `credits_required` and

    `credits_available` on `402 out_of_credits`, `profile_id` on a profile-creation refusal). Every response, success or error, carries an `X-Request-Id` header to quote at support. Invalid JSON in any request body is `400 invalid_json`. A path whose id segment is not a UUID

    never reaches a handler: it is `404 not_found`. CORS: the preflight allows `GET`, `POST`, `DELETE` and `OPTIONS` with the `authorization`,

    `content-type`, `accept` and `idempotency-key` headers, so every route can be called from a

    browser page as well as from servers and tools. ## Rate limits


    60 requests a minute per API key on every route (`429 rate_limited`). Some routes add an hourly

    budget per account, stated on the operation (`x-rate-limit`): voice-match 200 an hour, profile

    extraction 5 an hour, brand mimic 3 an hour, saved edits 200 an hour, invoice 30, portal link 20,

    checkout link 10. Polling a job counts against the 60 a minute. ## Credits


    Drafts, polish, humanize, page rewrites and brand mimic cost credits from the same pool the app

    uses; everything else is free (`x-credits` on each operation). A draft, polish or humanize is

    priced by length: up to 5,000 words 1 credit, up to 10,000 words 2, up to 15,000 words 3,

    charged per produced variant **after** it is delivered, so a failed call costs nothing. A page

    rewrite is 1 credit per 1,500 rewritable words (minimum 1). Brand mimic costs one brand-mimic

    credit. A wallet short of the price answers `402 out_of_credits` (or `402 insufficient_credits`

    on a page rewrite). Every route that calls a model can also answer `402 budget_exceeded` when the

    account''s monthly AI-spend ceiling is reached. ## Long drafts and background jobs


    A draft above 4,000 words, or a polish or humanize above 3,000 words, is written in the

    background: the call answers `202 Accepted` with a `job` object and a `poll` path. Poll

    `GET /v1/jobs/{id}` (or `GET /v1/generations/{id}` for a draft) every 10 to 30 seconds.'
  termsOfService: https://scriptgrain.com/terms
  contact:
    name: ScriptGrain support
    email: support@scriptgrain.com
    url: https://scriptgrain.com/support
  license:
    name: ScriptGrain Terms of Service
    url: https://scriptgrain.com/terms
servers:
- url: https://auth.scriptgrain.com/functions/v1/api-v1
  description: Production. Every path below is appended to this base.
security:
- ApiKey: []
tags:
- name: Brief templates
  description: Saved briefs to start the next piece from.
paths:
  /v1/brief-templates:
    get:
      operationId: listBriefTemplates
      tags:
      - Brief templates
      summary: List brief templates
      description: 'Saved briefs to start the next piece from, the same templates as the app''s Brief panel. A key

        sees its owner''s own templates plus any shared with the key''s organisation (a team key sees

        the team''s templates only, and saves every template to the team): most recently

        used first, then most recently updated, up to 100. Pass a template''s id as `template_id` on

        `POST /v1/outlines` or a one-shot `POST /v1/generations` (not together with `generation_id`)

        to fill the fields the request leaves empty and stamp `last_used_at`.'
      x-credits: free
      x-rate-limit: 60 requests a minute per key (global)
      x-plans: all plans
      responses:
        '200':
          description: The templates.
          headers:
            X-Request-Id:
              $ref: '#/components/headers/X-Request-Id'
          content:
            application/json:
              schema:
                type: object
                required:
                - templates
                properties:
                  templates:
                    type: array
                    items:
                      $ref: '#/components/schemas/BriefTemplate'
              example:
                templates:
                - id: 6a7b8c9d-0e1f-4a2b-b3c4-d5e6f7a8b9c0
                  name: Weekly product update
                  content_type: article
                  topic: What shipped this week
                  angle: ''
                  audience: Existing customers
                  register: conversational
                  key_points: ''
                  extra_direction: ''
                  word_count: 600
                  last_used_at: '2026-10-19T07:30:00.000Z'
                  created_at: '2026-10-01T09:00:00.000Z'
                  updated_at: '2026-10-01T09:00:00.000Z'
                  shared_with_team: false
                  yours: true
        '401':
          $ref: '#/components/responses/Unauthorized'
        '429':
          $ref: '#/components/responses/RateLimited'
        '500':
          description: '`internal_error`: the templates query failed.'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
    post:
      operationId: createBriefTemplate
      tags:
      - Brief templates
      summary: Save a brief template
      description: 'Saves a reusable brief. `name` and `content_type` are required, and at least one of `topic`,

        `key_points` or `extra_direction` must be non-empty. `share_with_team: true` shares the

        template with the key''s organisation, which must be a team workspace the key owner belongs

        to.'
      x-credits: free
      x-rate-limit: 60 requests a minute per key (global)
      x-plans: all plans
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/BriefTemplateInput'
            example:
              name: Weekly product update
              content_type: article
              topic: What shipped this week
              audience: Existing customers
              register: conversational
              word_count: 600
              share_with_team: false
      responses:
        '200':
          description: The saved template.
          headers:
            X-Request-Id:
              $ref: '#/components/headers/X-Request-Id'
          content:
            application/json:
              schema:
                type: object
                required:
                - template
                properties:
                  template:
                    $ref: '#/components/schemas/BriefTemplate'
              example:
                template:
                  id: 6a7b8c9d-0e1f-4a2b-b3c4-d5e6f7a8b9c0
                  name: Weekly product update
                  content_type: article
                  topic: What shipped this week
                  angle: ''
                  audience: Existing customers
                  register: conversational
                  key_points: ''
                  extra_direction: ''
                  word_count: 600
                  last_used_at: null
                  created_at: '2026-10-21T09:00:00.000Z'
                  updated_at: '2026-10-21T09:00:00.000Z'
                  shared_with_team: false
                  yours: true
        '400':
          description: '`invalid_json`: body is not valid JSON. `invalid_request`: a field failed validation (the message names it). `not_a_team_key`: `share_with_team` was true but the key does not belong to a team workspace the owner is a member of.'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '429':
          $ref: '#/components/responses/RateLimited'
        '500':
          description: '`internal_error`: saving the template failed.'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
  /v1/brief-templates/{id}:
    delete:
      operationId: deleteBriefTemplate
      tags:
      - Brief templates
      summary: Delete a brief template
      description: 'Deletes a template the key can see. The author may delete their own; for a template shared by

        a teammate, only a team owner or admin may.'
      x-credits: free
      x-rate-limit: 60 requests a minute per key (global)
      x-plans: all plans
      parameters:
      - name: id
        in: path
        required: true
        description: Brief template id.
        schema:
          $ref: '#/components/schemas/Uuid'
      responses:
        '200':
          description: The template was deleted.
          headers:
            X-Request-Id:
              $ref: '#/components/headers/X-Request-Id'
          content:
            application/json:
              schema:
                type: object
                required:
                - deleted
                - id
                properties:
                  deleted:
                    type: boolean
                    const: true
                  id:
                    $ref: '#/components/schemas/Uuid'
              example:
                deleted: true
                id: 6a7b8c9d-0e1f-4a2b-b3c4-d5e6f7a8b9c0
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          description: '`not_template_author`: the template belongs to someone else and you are not a team owner or admin.'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: '`template_not_found`: no template with that id visible to this key.'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '429':
          $ref: '#/components/responses/RateLimited'
        '500':
          description: '`internal_error`: a lookup or the delete failed.'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
components:
  responses:
    RateLimited:
      description: '`rate_limited`: more than 60 requests in a minute on this key, or a route''s hourly budget is used.'
      headers:
        X-Request-Id:
          $ref: '#/components/headers/X-Request-Id'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error:
              code: rate_limited
              message: Rate limit exceeded (60 req/min per API key). Try again shortly.
    Unauthorized:
      description: '`unauthorized`: the `Authorization` header is missing or malformed. `invalid_api_key`: the key

        is not recognised or was revoked. For a guest key also `guest_expired` and `guest_claimed`.

        '
      headers:
        X-Request-Id:
          $ref: '#/components/headers/X-Request-Id'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error:
              code: invalid_api_key
              message: API key not recognised.
  schemas:
    Uuid:
      type: string
      format: uuid
      description: A UUID. Path ids that are not UUID-shaped never match a route (404 `not_found`).
      example: 3f2b9c1e-6a4d-4e8f-9b1a-2c3d4e5f6a7b
    BriefTemplateInput:
      type: object
      required:
      - name
      - content_type
      description: At least one of `topic`, `key_points` or `extra_direction` must be non-blank.
      properties:
        name:
          type: string
          minLength: 1
          maxLength: 80
        content_type:
          $ref: '#/components/schemas/ContentType'
        topic:
          type: string
          maxLength: 2000
        angle:
          type: string
          maxLength: 2000
        audience:
          type: string
          maxLength: 500
        register:
          type: string
          maxLength: 500
          description: Free text up to 500 characters; not restricted to the Register enum.
        key_points:
          type: string
          maxLength: 4000
        extra_direction:
          type: string
          maxLength: 2000
        word_count:
          type:
          - integer
          - 'null'
          minimum: 50
          maximum: 15000
        share_with_team:
          type: boolean
          default: false
          description: Share with the key's organisation (a team workspace you belong to).
    Error:
      type: object
      description: 'The error envelope every failure returns. `error.code` is stable and listed in this

        description''s error-code table; `error.message` is for people and may change. Some codes

        add fields beside them (`credits_required`, `credits_available`, `profile_id`,

        `generation_id`, `retry_after_seconds`). A guest key''s errors also carry `claim_url` and

        `expires_at` at the top level.

        '
      required:
      - error
      properties:
        error:
          type: object
          required:
          - code
          - message
          properties:
            code:
              type: string
              examples:
              - invalid_request
              - out_of_credits
              - profile_not_found
            message:
              type: string
          additionalProperties: true
      additionalProperties: true
      example:
        error:
          code: invalid_request
          message: brief (string) is required.
    BriefTemplate:
      type: object
      required:
      - id
      - name
      - content_type
      - topic
      - angle
      - audience
      - register
      - key_points
      - extra_direction
      - word_count
      - last_used_at
      - created_at
      - updated_at
      - shared_with_team
      - yours
      properties:
        id:
          $ref: '#/components/schemas/Uuid'
        name:
          type: string
        content_type:
          $ref: '#/components/schemas/ContentType'
        topic:
          type: string
        angle:
          type: string
        audience:
          type: string
        register:
          type: string
        key_points:
          type: string
        extra_direction:
          type: string
        word_count:
          type:
          - integer
          - 'null'
        last_used_at:
          type:
          - string
          - 'null'
          format: date-time
        created_at:
          type: string
          format: date-time
        updated_at:
          type: string
          format: date-time
        shared_with_team:
          type: boolean
          description: True when the template is shared with an organisation.
        yours:
          type: boolean
          description: True when the key's owner wrote it.
    ContentType:
      type: string
      description: 'The 16 content types and their word ranges (`word_count_target`) with the default used when

        it is omitted: `article` 500–15,000 (800), `linkedin` 80–400 (220), `newsletter` 250–5,000

        (500), `email` 60–400 (180), `short_story` 200–15,000 (600), `social_post` 30–200 (120),

        `twitter_thread` 100–500 (250), `instagram_caption` 40–300 (120), `blog_intro` 80–400 (200),

        `press_release` 150–700 (350), `product_description` 60–400 (150), `ad_copy` 30–200 (80),

        `website_landing` 200–15,000 (400), `website_home` 200–15,000 (350), `website_product`

        200–15,000 (350), `website_about` 200–15,000 (400). `blog_intro` is only the opening section

        of a post; a whole post is `article`.

        '
      enum:
      - article
      - linkedin
      - newsletter
      - email
      - short_story
      - social_post
      - twitter_thread
      - instagram_caption
      - blog_intro
      - press_release
      - product_description
      - ad_copy
      - website_landing
      - website_home
      - website_product
      - website_about
  headers:
    X-Request-Id:
      description: A 16-character hex id for this request. Quote it when contacting support.
      schema:
        type: string
        pattern: ^[0-9a-f]{16}$
      example: 8c99d4ada706a856
  securitySchemes:
    ApiKey:
      type: http
      scheme: bearer
      bearerFormat: sg_live_<secret> or sg_guest_<token>
      description: 'An API key minted in the app (Settings, then API), sent as `Authorization: Bearer sg_live_…`.

        The secret is shown once; the server stores a SHA-256 hash. A guest token from

        `POST /v1/guest` (`sg_guest_…`) is sent the same way and may call only the routes marked

        `x-guest-allowed`.

        '
externalDocs:
  description: Human-readable API documentation
  url: https://scriptgrain.com/docs/api.md