> ## Documentation Index
> Fetch the complete documentation index at: https://docs.diagramkit.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Edit without the AI: wording, and by part: restyle, hide, show, nudge, place, swap, move, align, distribute



## OpenAPI

````yaml /openapi.json post /diagrams/{id}/edits
openapi: 3.1.0
info:
  title: diagramkit API
  version: '1'
  description: >-
    Make, change, animate and download diagrams. Full reference: /docs/api.md on
    diagramkit’s site.
servers:
  - url: https://app.diagramkit.ai/api/v1
security:
  - bearer: []
paths:
  /diagrams/{id}/edits:
    post:
      summary: >-
        Edit without the AI: wording, and by part: restyle, hide, show, nudge,
        place, swap, move, align, distribute
      operationId: editDiagram
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
            format: uuid
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              description: >-
                At least one edit. Parts are named by their ids from GET
                /diagrams/{id}/parts.
              properties:
                page:
                  type: integer
                  minimum: 1
                  maximum: 100
                  default: 1
                  description: Which page of a multi-page diagram.
                text:
                  type: array
                  maxItems: 30
                  description: Wording. Also accepted as edits.
                  items:
                    type: object
                    required:
                      - before
                      - after
                    properties:
                      before:
                        type: string
                        maxLength: 600
                      after:
                        type: string
                        maxLength: 600
                restyle:
                  type: array
                  maxItems: 100
                  items:
                    type: object
                    required:
                      - part
                      - style
                    properties:
                      part:
                        type: string
                        maxLength: 250
                        description: >-
                          A part id from the parts list: a name from what the
                          part is, such as "node:api", "link:api->db",
                          "text:monthly-revenue", "cell:0/2" or
                          "mark:revenue/2024", which stays the same through
                          edits; or its position, such as "0/2/1".
                      style:
                        type: object
                        additionalProperties: false
                        properties:
                          stroke:
                            type: string
                            maxLength: 200
                          fill:
                            type: string
                            maxLength: 200
                          background-color:
                            type: string
                            maxLength: 200
                          color:
                            type: string
                            maxLength: 200
                          font-family:
                            type: string
                            maxLength: 200
                          font-size:
                            type: string
                            maxLength: 200
                          font-weight:
                            type: string
                            maxLength: 200
                          visibility:
                            type: string
                            maxLength: 200
                        description: >-
                          fill colours a shape or box, color its text; an empty
                          value takes back an earlier change.
                hide:
                  type: array
                  maxItems: 100
                  items:
                    type: string
                    maxLength: 250
                    description: >-
                      A part id from the parts list: a name from what the part
                      is, such as "node:api", "link:api->db",
                      "text:monthly-revenue", "cell:0/2" or "mark:revenue/2024",
                      which stays the same through edits; or its position, such
                      as "0/2/1".
                show:
                  type: array
                  maxItems: 100
                  items:
                    type: string
                    maxLength: 250
                    description: >-
                      A part id from the parts list: a name from what the part
                      is, such as "node:api", "link:api->db",
                      "text:monthly-revenue", "cell:0/2" or "mark:revenue/2024",
                      which stays the same through edits; or its position, such
                      as "0/2/1".
                  description: Parts hidden earlier with hide.
                nudge:
                  type: array
                  maxItems: 100
                  items:
                    type: object
                    required:
                      - part
                      - dx
                      - dy
                    properties:
                      part:
                        type: string
                        maxLength: 250
                        description: >-
                          A part id from the parts list: a name from what the
                          part is, such as "node:api", "link:api->db",
                          "text:monthly-revenue", "cell:0/2" or
                          "mark:revenue/2024", which stays the same through
                          edits; or its position, such as "0/2/1".
                      layout:
                        type: string
                        enum:
                          - wide
                          - compact
                          - both
                        default: wide
                        description: >-
                          wide: the desktop layout (900 px); compact: the phone
                          layout (390 px); both: each layout the part has.
                      dx:
                        type: number
                        minimum: -4000
                        maximum: 4000
                      dy:
                        type: number
                        minimum: -4000
                        maximum: 4000
                  description: Shift a movable part dx, dy px from where it is now.
                place:
                  type: array
                  maxItems: 100
                  items:
                    type: object
                    required:
                      - part
                      - relative_to
                      - side
                    properties:
                      part:
                        type: string
                        maxLength: 250
                        description: >-
                          A part id from the parts list: a name from what the
                          part is, such as "node:api", "link:api->db",
                          "text:monthly-revenue", "cell:0/2" or
                          "mark:revenue/2024", which stays the same through
                          edits; or its position, such as "0/2/1".
                      relative_to:
                        type: string
                        maxLength: 250
                        description: >-
                          A part id from the parts list: a name from what the
                          part is, such as "node:api", "link:api->db",
                          "text:monthly-revenue", "cell:0/2" or
                          "mark:revenue/2024", which stays the same through
                          edits; or its position, such as "0/2/1".
                      side:
                        type: string
                        enum:
                          - left
                          - right
                          - above
                          - below
                      gap:
                        type: number
                        minimum: 0
                        maximum: 1000
                        default: 40
                      layout:
                        type: string
                        enum:
                          - wide
                          - compact
                          - both
                        default: wide
                        description: >-
                          wide: the desktop layout (900 px); compact: the phone
                          layout (390 px); both: each layout the part has.
                  description: >-
                    Put a movable part beside another, centred on it across that
                    side.
                swap:
                  type: array
                  maxItems: 50
                  items:
                    type: object
                    required:
                      - a
                      - b
                    properties:
                      a:
                        type: string
                        maxLength: 250
                        description: >-
                          A part id from the parts list: a name from what the
                          part is, such as "node:api", "link:api->db",
                          "text:monthly-revenue", "cell:0/2" or
                          "mark:revenue/2024", which stays the same through
                          edits; or its position, such as "0/2/1".
                      b:
                        type: string
                        maxLength: 250
                        description: >-
                          A part id from the parts list: a name from what the
                          part is, such as "node:api", "link:api->db",
                          "text:monthly-revenue", "cell:0/2" or
                          "mark:revenue/2024", which stays the same through
                          edits; or its position, such as "0/2/1".
                      layout:
                        type: string
                        enum:
                          - wide
                          - compact
                          - both
                        default: wide
                        description: >-
                          wide: the desktop layout (900 px); compact: the phone
                          layout (390 px); both: each layout the part has.
                  description: Exchange two movable parts' positions, centre for centre.
                move:
                  type: array
                  maxItems: 100
                  items:
                    type: object
                    required:
                      - part
                      - dx
                      - dy
                    properties:
                      part:
                        type: string
                        maxLength: 250
                        description: >-
                          A part id from the parts list: a name from what the
                          part is, such as "node:api", "link:api->db",
                          "text:monthly-revenue", "cell:0/2" or
                          "mark:revenue/2024", which stays the same through
                          edits; or its position, such as "0/2/1".
                      layout:
                        type: string
                        enum:
                          - wide
                          - compact
                          - both
                        default: wide
                        description: >-
                          wide: the desktop layout (900 px); compact: the phone
                          layout (390 px); both: each layout the part has.
                      dx:
                        type: number
                        minimum: -4000
                        maximum: 4000
                      dy:
                        type: number
                        minimum: -4000
                        maximum: 4000
                  description: >-
                    Offset in px from where diagramkit placed the part (0, 0
                    puts it back).
                align:
                  type: object
                  required:
                    - parts
                    - to
                  properties:
                    parts:
                      type: array
                      minItems: 2
                      maxItems: 100
                      items:
                        type: string
                        maxLength: 250
                        description: >-
                          A part id from the parts list: a name from what the
                          part is, such as "node:api", "link:api->db",
                          "text:monthly-revenue", "cell:0/2" or
                          "mark:revenue/2024", which stays the same through
                          edits; or its position, such as "0/2/1".
                    to:
                      type: string
                      enum:
                        - left
                        - center
                        - right
                        - top
                        - middle
                        - bottom
                    layout:
                      type: string
                      enum:
                        - wide
                        - compact
                        - both
                      default: wide
                      description: >-
                        wide: the desktop layout (900 px); compact: the phone
                        layout (390 px); both: each layout the part has.
                distribute:
                  type: object
                  required:
                    - parts
                    - axis
                  properties:
                    parts:
                      type: array
                      minItems: 3
                      maxItems: 100
                      items:
                        type: string
                        maxLength: 250
                        description: >-
                          A part id from the parts list: a name from what the
                          part is, such as "node:api", "link:api->db",
                          "text:monthly-revenue", "cell:0/2" or
                          "mark:revenue/2024", which stays the same through
                          edits; or its position, such as "0/2/1".
                    axis:
                      type: string
                      enum:
                        - horizontal
                        - vertical
                    layout:
                      type: string
                      enum:
                        - wide
                        - compact
                        - both
                      default: wide
                      description: >-
                        wide: the desktop layout (900 px); compact: the phone
                        layout (390 px); both: each layout the part has.
                styles:
                  type: array
                  maxItems: 100
                  description: The canvas editor's own form, by element position.
                  items:
                    type: object
                    required:
                      - path
                      - style
                    properties:
                      path:
                        type: string
                      label:
                        type: string
                        maxLength: 80
                      tag:
                        type: string
                      style:
                        type: object
                        additionalProperties:
                          type: string
                moves:
                  type: array
                  maxItems: 100
                  description: The canvas editor's own form, by move key.
                  items:
                    type: object
                    required:
                      - key
                      - layout
                      - dx
                      - dy
                    properties:
                      key:
                        type: string
                      layout:
                        type: string
                        enum:
                          - wide
                          - compact
                      dx:
                        type: number
                      dy:
                        type: number
      responses:
        '200':
          description: The finished job.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Job'
        '202':
          description: Accepted and still being made.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Job'
        '402':
          description: >-
            no_credits: the balance cannot pay for this request (per page: 5
            credits a new diagram, 2 a change, 8 an animation). Nothing is
            charged.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        default:
          description: An error.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
components:
  schemas:
    Job:
      type: object
      properties:
        id:
          type: string
          format: uuid
        status:
          type: string
          enum:
            - queued
            - running
            - succeeded
            - failed
        title:
          type:
            - string
            - 'null'
        description:
          type:
            - string
            - 'null'
          description: What the diagram shows and any assumptions it made.
        version:
          type: integer
          description: How many versions it has; 0 until the first is made.
        animated:
          type: boolean
        preset:
          type:
            - string
            - 'null'
          description: >-
            Where the diagram will be used, as it was made or last revised for;
            null without one.
        progress:
          type:
            - string
            - 'null'
        image_url:
          type:
            - string
            - 'null'
          format: uri
        downloads:
          type:
            - object
            - 'null'
          additionalProperties:
            type: string
            format: uri
          description: png, jpg, svg, pdf, and mp4 and gif when animated.
        recommended_download:
          type: object
          description: >-
            With a preset, once there is a version: the download it offers
            first, as format, url and the query options in that url.
          properties:
            format:
              type: string
            url:
              type: string
              format: uri
            options:
              type: object
              additionalProperties:
                type: string
        error:
          type:
            - object
            - 'null'
          description: >-
            Why a failed job failed. type no_credits (the balance cannot pay for
            the planned pages) and too_many_pages (a set longer than max_pages
            or 100 pages) are refused before anything is drawn or charged;
            otherwise generation_failed.
          properties:
            type:
              type: string
              enum:
                - generation_failed
                - no_credits
                - too_many_pages
            message:
              type: string
        created_at:
          type: string
          format: date-time
        applied:
          type: array
          items:
            type: object
          description: 'Edits only: the wording changes made.'
        moved:
          type: array
          items:
            type: object
            properties:
              part:
                type: string
              wide:
                type: array
                items:
                  type: number
              compact:
                type: array
                items:
                  type: number
          description: >-
            Edits only: each part an edit moved, with its new box [left, top,
            width, height] per layout.
        skipped:
          type: array
          items:
            type: object
          description: 'Edits only: the wording changes not made, with a reason.'
      required:
        - id
        - status
        - version
        - animated
        - created_at
    Error:
      type: object
      properties:
        error:
          type: object
          properties:
            type:
              type: string
            message:
              type: string
            issues:
              type: array
              items:
                type: string
          required:
            - type
            - message
  securitySchemes:
    bearer:
      type: http
      scheme: bearer
      description: An API key (aid_…) from Settings › API.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.