Scrape a webpage to create a source

POST /sources/webpage

Scrape a webpage 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

  • url string Required

    The url of the webpage to be scraped

  • headers array[object]

    The headers to be used while scraping the webpage

    Hide headers attributes Show headers attributes
    • name string

      The name of the header

    • value string

      The value of the header

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/webpage
curl \
 -X POST https://api.hansei.app/public/v1/sources/webpage \
 -H "X-API-KEY: $API_KEY" \
 -H "Content-Type: application/json" \
 -d '{"value":{"name":"Employee Handbook","collections":["col_X1p7UscyehUFc6O4","col_HIjpFiRemkbpHgUn"],"url":"https://example.com/employees/handbook","headers":[{"name":"Authorization","value":"Bearer \u003ctoken\u003e"}]}}'
Request example
{
  "value": {
    "name": "Employee Handbook",
    "collections": [
      "col_X1p7UscyehUFc6O4",
      "col_HIjpFiRemkbpHgUn"
    ],
    "url": "https://example.com/employees/handbook",
    "headers": [
      {
        "name": "Authorization",
        "value": "Bearer <token>"
      }
    ]
  }
}
Request examples
{
  "name": "string",
  "collections": [
    "string"
  ],
  "url": "string",
  "headers": [
    {
      "name": "string",
      "value": "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"
}