Lang.ai Projects API

Create and inspect classification projects and their tags.

OpenAPI Specification

langai-projects-api-openapi.yml Raw ↑
openapi: 3.0.3
info:
  title: Lang.ai Documents Projects API
  version: '1.0'
  description: 'The Lang.ai API is organized around REST, with predictable resource-oriented URLs, HTTP verbs and HTTP response codes. JSON is returned by all API responses, including errors. The API builds and applies custom text classifiers: create a project from a dataset of customer interactions, let the algorithm extract intents and features that are grouped into tags, then analyze and save new documents (support tickets, chatbot messages) against that project in real time. Generated by the API Evangelist enrichment pipeline from the published API reference at https://docs.lang.ai/ — Lang.ai does not publish a machine-readable specification.'
  contact:
    name: Lang.ai Help Center
    url: https://help.lang.ai/
  x-generated-by: api-evangelist-enrichment-pipeline
  x-generated-from: https://docs.lang.ai/
  x-method: generated
servers:
- url: https://{company}.lang.ai/api/v1
  description: Per-tenant Lang.ai instance. Replace the company variable with the subdomain of the Lang.ai instance you are using.
  variables:
    company:
      default: company
      description: The subdomain of your Lang.ai instance.
security:
- bearerAuth: []
tags:
- name: Projects
  description: Create and inspect classification projects and their tags.
paths:
  /project:
    post:
      operationId: createProject
      tags:
      - Projects
      summary: Create a project
      description: Create a project by performing a single multipart/related request (RFC 2387) containing both the project metadata and the contents of a dataset. The metadata part must come first with Content-Type application/json; charset=UTF-8, and the media part second with Content-Type text/plain or text/csv.
      requestBody:
        required: true
        content:
          multipart/related:
            schema:
              type: object
              required:
              - metadata
              - media
              properties:
                metadata:
                  $ref: '#/components/schemas/ProjectMetadata'
                media:
                  type: string
                  format: binary
                  description: The data from the file to be uploaded. Extra CSV columns may be included to be used as metadata.
      responses:
        '200':
          description: The id of the project that is being created.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProjectCreated'
              example:
                id: project_id
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/InternalServerError'
  /projects:
    get:
      operationId: listProjects
      tags:
      - Projects
      summary: List projects
      description: Returns the list of projects. The request does not require a JSON body.
      responses:
        '200':
          description: A list of zero, one or more projects.
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Project'
              example:
              - status: Processing
                id: sWP2ll1v16lLdMxM
                name: My first project
                createdAt: '2021-03-22T13:54:55Z'
              - status: Completed
                id: l3wNMwIXM1S046Sy
                name: My second project
                createdAt: '2021-03-23T13:54:55Z'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/InternalServerError'
  /projects/{projectId}:
    get:
      operationId: getProjectTags
      tags:
      - Projects
      summary: List project tags
      description: Returns the project information as well as the list of zero, one or more tags defined on the project. The request does not require a JSON body.
      parameters:
      - name: projectId
        in: path
        required: true
        description: The ID of the project.
        schema:
          type: string
        example: l3wNMwIXM1S046Sy
      responses:
        '200':
          description: The project and its tags.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProjectWithTags'
              example:
                status: Completed
                id: l3wNMwIXM1S046Sy
                name: My second project
                createdAt: '2021-03-23T13:54:55Z'
                tags:
                - id: tqGMbCpTBZOJaram
                  name: My first tag
                  createdAt: '2021-04-21T12:40:50.892265Z'
                  updatedAt: '2021-04-25T11:35:43.512464Z'
                  isDraft: false
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/InternalServerError'
components:
  responses:
    NotFound:
      description: Project not found
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    TooManyRequests:
      description: Too many requests / Rate limited
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    Unauthorized:
      description: Unauthorized
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    InternalServerError:
      description: Internal server error
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    BadRequest:
      description: Bad request / Missing fields
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  schemas:
    ProjectMetadata:
      type: object
      required:
      - name
      - csvOptions
      - team_ids
      properties:
        name:
          type: string
          description: The name of the project.
        csvOptions:
          type: object
          required:
          - textColumn
          properties:
            textColumn:
              type: string
              description: The name of the column from the CSV file containing each document's text.
            dateColumn:
              type: string
              description: Optional. The name of the column from the CSV file that contains the document's date.
        team_ids:
          type: array
          description: The list of team ids that will have access to the project.
          items:
            type: string
    Project:
      type: object
      properties:
        status:
          type: string
          description: 'The project status: Errored, Processing, Completed.'
          enum:
          - Errored
          - Processing
          - Completed
        id:
          type: string
          description: The ID of the project.
        name:
          type: string
          description: The name of the project.
        createdAt:
          type: string
          description: The creation date of the project.
    Tag:
      type: object
      properties:
        id:
          type: string
          description: The ID of the tag.
        name:
          type: string
          description: The name of the tag.
        createdAt:
          type: string
          description: The creation date of the tag.
        updatedAt:
          type: string
          description: The last update date of the tag.
        isDraft:
          type: boolean
          description: Whether or not the tag is draft.
    ProjectCreated:
      type: object
      properties:
        id:
          type: string
          description: The id of the project.
    ProjectWithTags:
      allOf:
      - $ref: '#/components/schemas/Project'
      - type: object
        properties:
          tags:
            type: array
            description: An array of tags.
            items:
              $ref: '#/components/schemas/Tag'
    Error:
      type: object
      description: JSON is returned by all API responses, including errors. Lang.ai documents the HTTP status codes but does not publish a field-level error envelope schema.
      additionalProperties: true
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: 'Authenticate your account by including your secret API token in every request as an Authorization: Bearer header. Create a new API token from the Settings section of your Lang.ai instance. Generating a new token invalidates previously issued ones.'