Skip to main content

Overview

For a deeper walk-through, follow the API Server tutorial; the snippet below shows the type of output produced from a simple LLM prompt.

LLM Prompt for a To Do app

Build me an API server that helps users track To Dos. It should include the ability to set deadlines on To Do items, as well as mark them completed
This results in an API Server with a downloadable OpenAPI document.
api.yaml
openapi: 3.1.1
info:
  title: TaskTracker Pro
  version: 1.0.1
  description: Manage and track personal tasks with deadlines to stay organized and ensure timely completion of work
jsonSchemaDialect: https://spec.openapis.org/oas/3.1/dialect/base
servers:
  - url: https://fc9fe14b-43ed-4a3b-99a7-ee4d0ba13224.app.withsutro.com/api/v1.0.1
    description: Development Server
components:
  schemas:
    User:
      type: object
      required:
        - id
        - todos
      properties:
        id:
          type: string
          format: uuid
        name:
          type: string
          $comment: p_TEXT
        email:
          type: string
          $comment: p_TEXT
        todos:
          type: array
          items:
            $ref: "#/components/schemas/ToDo"
          $comment: "urn:sutro:model:toDo"
          x-sutro-relOwner: true
      title: User
      description: User
      additionalProperties: false
      $id: User
    ToDo:
      type: object
      required:
        - id
        - user
      properties:
        id:
          type: string
          format: uuid
        title:
          type: string
          $comment: p_TEXT
        description:
          type: string
          $comment: p_TEXT
        deadline:
          type: string
          format: date-time
          $comment: p_DATE_TIME
        status:
          type: string
          $comment: p_TEXT
        user:
          $ref: "#/components/schemas/User"
          $comment: "urn:sutro:model:user"
          x-sutro-relOwner: false
      title: ToDo
      description: To Do
      additionalProperties: false
      $id: ToDo
  responses:
    GetUsersResponse:
      description: Entities retrieved successfully
      content:
        application/json:
          schema:
            type: object
            additionalProperties: false
            properties:
              data:
                type: array
                items:
                  $ref: "#/components/schemas/User"
              total:
                type: number
    GetUserResponse:
      description: getEntity successful
      content:
        application/json:
          schema:
            $ref: "#/components/schemas/User"
    CreateUserResponse:
      description: createEntity successful
      content:
        application/json:
          schema:
            $ref: "#/components/schemas/User"
    UpdateUserResponse:
      description: updateEntity successful
      content:
        application/json:
          schema:
            $ref: "#/components/schemas/User"
    DeleteUserResponse:
      description: Response for Create urn:sutro:action:deleteUserServer
    GetToDosResponse:
      description: Entities retrieved successfully
      content:
        application/json:
          schema:
            type: object
            additionalProperties: false
            properties:
              data:
                type: array
                items:
                  $ref: "#/components/schemas/ToDo"
              total:
                type: number
    GetToDoResponse:
      description: getEntity successful
      content:
        application/json:
          schema:
            $ref: "#/components/schemas/ToDo"
    CreateToDoResponse:
      description: createEntity successful
      content:
        application/json:
          schema:
            $ref: "#/components/schemas/ToDo"
    UpdateToDoResponse:
      description: updateEntity successful
      content:
        application/json:
          schema:
            $ref: "#/components/schemas/ToDo"
    DeleteToDoResponse:
      description: Response for Create urn:sutro:action:deleteToDoServer
  requestBodies:
    CreateUserRequestBody:
      description: Request body for createUser
      content:
        application/json:
          schema:
            type: object
            required:
              - todos
            properties:
              name:
                type: string
                $comment: p_TEXT
              email:
                type: string
                $comment: p_TEXT
              todos:
                type: array
                items:
                  type: string
                  description: ID of To Do
                $comment: "urn:sutro:model:toDo"
                x-sutro-relOwner: true
            title: User
            description: Request body for User
            additionalProperties: false
            $id: CreateUserRequestBody
      required: true
    UpdateUserRequestBody:
      description: Request body for updateUser
      content:
        application/json:
          schema:
            type: object
            properties:
              name:
                type: string
                $comment: p_TEXT
              email:
                type: string
                $comment: p_TEXT
              todos:
                type: array
                items:
                  type: string
                  description: ID of To Do
                $comment: "urn:sutro:model:toDo"
                x-sutro-relOwner: true
            $id: UpdateUserRequestBody
            description: Request body for User
      required: true
    CreateToDoRequestBody:
      description: Request body for createTo Do
      content:
        application/json:
          schema:
            type: object
            required:
              - user
            properties:
              title:
                type: string
                $comment: p_TEXT
              description:
                type: string
                $comment: p_TEXT
              deadline:
                type: string
                format: date-time
                $comment: p_DATE_TIME
              status:
                type: string
                $comment: p_TEXT
              user:
                type: string
                description: ID of User
                $comment: "urn:sutro:model:user"
                x-sutro-relOwner: false
            title: ToDo
            description: Request body for To Do
            additionalProperties: false
            $id: CreateToDoRequestBody
      required: true
    UpdateToDoRequestBody:
      description: Request body for updateTo Do
      content:
        application/json:
          schema:
            type: object
            properties:
              title:
                type: string
                $comment: p_TEXT
              description:
                type: string
                $comment: p_TEXT
              deadline:
                type: string
                format: date-time
                $comment: p_DATE_TIME
              status:
                type: string
                $comment: p_TEXT
              user:
                type: string
                description: ID of User
                $comment: "urn:sutro:model:user"
                x-sutro-relOwner: false
            $id: UpdateToDoRequestBody
            description: Request body for To Do
      required: true
paths:
  /users:
    get:
      operationId: getUsers
      summary: Get a collection of Users
      responses:
        "200":
          $ref: "#/components/responses/GetUsersResponse"
    post:
      operationId: createUser
      summary: Create a new User
      responses:
        "200":
          $ref: "#/components/responses/CreateUserResponse"
      requestBody:
        $ref: "#/components/requestBodies/CreateUserRequestBody"
  /users/{id}:
    get:
      operationId: getUser
      summary: Get a single User
      responses:
        "200":
          $ref: "#/components/responses/GetUserResponse"
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
            format: uuid
    put:
      operationId: updateUser
      summary: Update an existing User
      responses:
        "200":
          $ref: "#/components/responses/UpdateUserResponse"
      requestBody:
        $ref: "#/components/requestBodies/UpdateUserRequestBody"
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
            format: uuid
    delete:
      operationId: deleteUser
      summary: Delete an existing User
      responses:
        "200":
          $ref: "#/components/responses/DeleteUserResponse"
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
            format: uuid
  /toDos:
    get:
      operationId: getTo Dos
      summary: Get a collection of To Dos
      responses:
        "200":
          $ref: "#/components/responses/GetToDosResponse"
    post:
      operationId: createTo Do
      summary: Create a new To Do
      responses:
        "200":
          $ref: "#/components/responses/CreateToDoResponse"
      requestBody:
        $ref: "#/components/requestBodies/CreateToDoRequestBody"
  /toDos/{id}:
    get:
      operationId: getTo Do
      summary: Get a single To Do
      responses:
        "200":
          $ref: "#/components/responses/GetToDoResponse"
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
            format: uuid
    put:
      operationId: updateTo Do
      summary: Update an existing To Do
      responses:
        "200":
          $ref: "#/components/responses/UpdateToDoResponse"
      requestBody:
        $ref: "#/components/requestBodies/UpdateToDoRequestBody"
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
            format: uuid
    delete:
      operationId: deleteTo Do
      summary: Delete an existing To Do
      responses:
        "200":
          $ref: "#/components/responses/DeleteToDoResponse"
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
            format: uuid
You can see API documentation for this example here.