Write a text to create a source

POST /sources/write

Write a text to create a source

Body

This is the source body object

  • name string Required

    The name of the source

  • collections array[string] Required

    The collections to which this source belongs to

  • content string Required

    The content of the source

Responses

  • A source response to be returned

    Hide response attributes Show response attributes object
  • Invalid Request body or missing required parameters

    Hide response attributes Show response attributes object
    • code string

      An error code specific to the error.

    • message string

      A human-readable message providing more details about the error.

  • Insufficient Credits

    Hide response attributes Show response attributes object
    • code string

      An error code specific to the error.

    • message string

      A human-readable message providing more details about the error.

POST /sources/write
curl \
 -X POST https://api.hansei.app/public/v1/sources/write \
 -H "X-API-KEY: $API_KEY" \
 -H "Content-Type: application/json" \
 -d '{"value":{"name":"Employee Handbook","collections":["col_X1p7UscyehUFc6O4","col_HIjpFiRemkbpHgUn"],"content":"Employee Handbook v1. Every employee should read this handbook..."}}'
Request example
{
  "value": {
    "name": "Employee Handbook",
    "collections": [
      "col_X1p7UscyehUFc6O4",
      "col_HIjpFiRemkbpHgUn"
    ],
    "content": "Employee Handbook v1. Every employee should read this handbook..."
  }
}
Request examples
{
  "name": "string",
  "collections": [
    "string"
  ],
  "content": "string"
}
Response examples (200)
{
  "value": {
    "id": "src_4uPeOYWyQ01C8Epg",
    "name": "Employee Onboarding",
    "collections": [
      {
        "id": "col_X1p7UscyehUFc6O4",
        "name": "Employee Onboarding"
      },
      {
        "id": "col_HIjpFiRemkbpHgUn",
        "name": "Customer Support"
      },
      "{...}",
      "{...}"
    ],
    "status": "pending",
    "created_at": 1697386660315
  }
}
Response examples (200)
{
  "id": "src_4uPeOYWyQ01C8Epg",
  "name": "Employee Onboarding",
  "collections": [
    {
      "id": "col_X1p7UscyehUFc6O4",
      "name": "Employee Onboarding"
    }
  ],
  "status": "pending",
  "created_at": 1697386660315
}
Response examples (400)
{
  "code": "string",
  "message": "string"
}
Response examples (400)
{
  "code": "string",
  "message": "string"
}
Response examples (402)
{
  "code": "string",
  "message": "string"
}
Response examples (402)
{
  "code": "string",
  "message": "string"
}