Creating a Custom Source

Create a custom Source and load the records that power AI answers.

Custom Sources let you load records from any system into Guru, where they're used to formulate AI-generated answers when users ask questions. This guide shows you how to create a Custom Source and load records to it, directly via the API or through Zapier.

Create the Custom Source

curl -X POST https://api.getguru.com/api/v1/sources \
  -u $GURU_USER:$GURU_TOKEN \
  -H "Content-Type: application/json" \
  -d '{
    "type": "CUSTOM",
    "config": {
      "name": "Source_Name_Goes_Here",
      "type": "CUSTOM"
    },
    "definition": {
      "type": "CUSTOM"
    }
  }'

The response looks like the example below. The id is the ID of the Custom Source; you'll need it later in this process.

{
    "id": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
    "type": "CUSTOM",
    "config": {
        "name": "Source_Name"
    },
    "createdBy": {
        "id": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
        "status": "ACTIVE",
        "email": "[email protected]",
        "lastName": "Duffy Demo",
        "firstName": "Joe"
    }
}

Load records

With the source created, load the records that Guru uses to formulate answers. There are two options: directly via the API, or through an iPaaS solution such as Zapier. You'll still need to be familiar with the API if you use an iPaaS solution.

Load records directly via the API

Use the source ID from the create call in the URL. Each record needs four elements:

FieldDescription
externalIdThe ID of the record in your system. Guru checks whether the record already exists: if it does, the record is updated; if not, a new record is created.
titleThe title of the record. Displayed in the Guru UI when Answers cites the record it used to formulate an answer.
urlThe URL of the record. Used as a hyperlink users can click to see the source of the answer. Must be a valid URL.
contentThe actual content of the record. Must be plain text, which means removing HTML tags, emojis, and similar markup.
curl -X PUT https://api.getguru.com/api/v1/sources/{sourceId}/records/{externalId} \
  -u $GURU_USER:$GURU_TOKEN \
  -H "Content-Type: application/json" \
  -d '{
    "externalId": "airtable_rec3lbPRG4aVqkeOQ",
    "title": "Record Title",
    "url": "https://airtable.com/app4UojDvMJ841ltD/tbleUfsyAmXerB7hv/rec3lbPRG4aVqkeOQ",
    "content": "Here is some record content in plain text."
  }'

Load records via Zapier

As with any Zapier automation, start with a trigger, such as "new or updated record in Airtable" or "row is updated in a Google Sheet." For this example, we add or update a record in our Guru Source whenever a record is added to or updated in an Airtable table.

You need two steps:

Configure the trigger in step 1 to fit your needs: choose the base, the table, and the timestamp field the automation should key off.

In step 2, make the API call outlined above to load the Airtable record into your Source. In the "Basic Auth" field, include your Guru email address, a pipe delimiter, then your Guru API token (for example, [email protected]|xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx).

❗️

Content must be plain text

The data passed in the content field needs to be plain text. Depending on your data, you may need a transformation step before the PUT call. A "Formatter by Zapier" action can strip HTML tags, quotes, carriage returns, tabs, and emojis.

Upload an icon to your Custom Source

Upload an icon for your Custom Source with a multipart/form-data request. There is no JSON request body; the file is uploaded directly as the iconImage field of the form data.

curl -X POST https://api.getguru.com/api/v1/sources/{sourceId}/config/iconUrl \
  -u $GURU_USER:$GURU_TOKEN \
  -H "Accept: application/json" \
  -F "iconImage=@/path/to/your/icon.png"

Replace /path/to/your/icon.png with the file path to your icon. Supported formats include .png and .jpg; a 1:1 aspect ratio renders best, and we recommend 200x200. On success, the API returns the updated configuration with the new iconUrl.

Other helpful Source API endpoints

DescriptionMethodEndpoint
Retrieve a list of sourcesGET/api/v1/sources
Retrieve a sourceGET/api/v1/sources/{sourceId}?fieldDetail=FULL
Delete a sourceDELETE/api/v1/sources/{sourceId}
Get a source recordGET/api/v1/sources/{sourceId}/records/{externalId}
Create or update a source recordPUT/api/v1/sources/{sourceId}/records/{externalId}
Delete a source recordDELETE/api/v1/sources/{sourceId}/records/{externalId}