Skip to main content
POST
/
v0
/
documents
JavaScript
import Avido from 'avido';

const client = new Avido({
  apiKey: process.env['AVIDO_API_KEY'], // This is the default and can be omitted
  applicationID: process.env['AVIDO_APPLICATION_ID'], // This is the default and can be omitted
});

const document = await client.documents.create({
  content: 'This document describes the API endpoints...',
  title: 'API Documentation',
  assignee: 'user_123456789',
  language: 'english',
  status: 'DRAFT',
});

console.log(document.document);
{
  "document": {
    "id": "123e4567-e89b-12d3-a456-426614174000",
    "createdAt": "2024-01-05T12:34:56.789Z",
    "modifiedAt": "2024-01-05T12:34:56.789Z",
    "orgId": "org_123456789",
    "assignee": "user_123456789",
    "type": "KNOWLEDGE",
    "optimized": false,
    "versions": [
      {
        "id": "321e4567-e89b-12d3-a456-426614174001",
        "createdAt": "2024-01-05T12:34:56.789Z",
        "modifiedAt": "2024-01-05T12:34:56.789Z",
        "orgId": "org_123456789",
        "title": "API Documentation",
        "content": "This document describes the API endpoints...",
        "metadata": {},
        "originalSentences": [
          "This is the first sentence.",
          "This is the second sentence."
        ],
        "language": "english",
        "status": "APPROVED",
        "type": "KNOWLEDGE",
        "versionNumber": 1,
        "documentId": "123e4567-e89b-12d3-a456-426614174000",
        "applicationId": "456e4567-e89b-12d3-a456-426614174000"
      }
    ],
    "title": "<string>",
    "content": "<string>",
    "applicationId": "456e4567-e89b-12d3-a456-426614174000",
    "scrapeJob": {
      "id": "123e4567-e89b-12d3-a456-426614174000",
      "createdAt": "2024-01-05T12:34:56.789Z",
      "modifiedAt": "2024-01-05T12:34:56.789Z",
      "orgId": "org_123",
      "initiatedBy": "user_123",
      "name": "Documentation Scrape",
      "url": "https://example.com",
      "status": "PENDING",
      "applicationId": "456e4567-e89b-12d3-a456-426614174000",
      "pages": [
        {
          "url": "https://example.com/page1",
          "title": "Page 1",
          "description": "This is the first page of the documentation.",
          "category": "Documentation"
        },
        {
          "url": "https://example.com/page2"
        }
      ]
    },
    "scrapeJobId": "321e4567-e89b-12d3-a456-426614174000",
    "quickstartId": "456e7890-e89b-12d3-a456-426614174000",
    "topicId": "789e1234-e89b-12d3-a456-426614174000"
  }
}

Authorizations

x-api-key
string
header
required

Your unique Avido API key

x-application-id
string
header
required

Your unique Avido Application ID

Body

application/json

Request body for creating a new document with its initial version

title
string
required

Title of the initial document version

Example:

"API Documentation"

content
string
required

Content of the initial document version

Example:

"This document describes the API endpoints..."

assignee
string

User ID of the person assigned to this document. Defaults to the authenticated user if not provided.

Example:

"user_123456789"

scrapeJobId
string<uuid>

Optional ID of the scrape job that generated this document

Pattern: ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
Example:

"321e4567-e89b-12d3-a456-426614174000"

type
enum<string>
default:KNOWLEDGE

Type of the document. Defaults to KNOWLEDGE.

Available options:
KNOWLEDGE,
POLICY
Example:

"KNOWLEDGE"

quickstartId
string<uuid>

Optional ID of the QuickstartV2 this document belongs to

Pattern: ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
Example:

"456e7890-e89b-12d3-a456-426614174000"

topicId
string<uuid>

Optional ID of the topic this document belongs to

Pattern: ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
Example:

"789e1234-e89b-12d3-a456-426614174000"

metadata
object

Optional metadata for the initial document version

originalSentences
string[]

Array of original sentences from the source

Example:
[
"This is the first sentence.",
"This is the second sentence."
]
status
enum<string>
default:DRAFT

Status of the initial document version

Available options:
DRAFT,
REVIEW,
APPROVED,
ARCHIVED,
ACTIVE
Example:

"DRAFT"

language
string
default:english

Language of the initial document version

Example:

"english"

Response

Document created successfully

Successful response containing the document data

document
object
required