---
title: "Add or update datasource"
method: POST
path: "/api/index/v1/adddatasource"
tags: ["Datasources"]
---

# Add or update datasource

`POST /api/index/v1/adddatasource`

Add or update a custom datasource and its schema.

## Request body

- CustomDatasourceConfig — Structure describing shared config properties of a datasource with no multi-instance support.
  - `name` string, required — Unique identifier of datasource instance to which this config applies.
  - `displayName` string — The user-friendly instance label to display. If omitted, falls back to the title-cased `name`.
  - `datasourceCategory` 'UNCATEGORIZED' | 'TICKETS' | 'CRM' | 'PUBLISHED_CONTENT' | 'COLLABORATIVE_CONTENT' | 'QUESTION_ANSWER' | 'MESSAGING' | 'CODE_REPOSITORY' | 'CHANGE_MANAGEMENT' | 'PEOPLE' | 'EMAIL' | 'SSO' | 'ATS' | 'KNOWLEDGE_HUB' | 'EXTERNAL_SHORTCUT' | 'ENTITY' | 'CALENDAR' | 'AGENTS' | 'AI_CONVERSATION' | 'AI_ARTIFACT' — The type of this datasource. It is an important signal for relevance and must be specified and cannot be UNCATEGORIZED. Please refer to [this](https://developers.glean.com/docs/indexing_api_datasource_category/) for more details.
  - `urlRegex` string — Regular expression that matches URLs of documents of the datasource instance. The behavior for multiple matches is non-deterministic. **Note: `urlRegex` is a required field for non-entity datasources, but not required if the datasource is used to push custom entities (ie. datasources where isEntityDatasource is false). Please add a regex as specific as possible to this datasource instance.**
  - `iconUrl` string — The URL to an image to be displayed as an icon for this datasource instance. Must have a transparency mask. SVG are recommended over PNG. Public, scio-authenticated and Base64 encoded data URLs are all valid (but not third-party-authenticated URLs).
  - `objectDefinitions` ObjectDefinition[] — The list of top-level `objectType`s for the datasource.
    - `name` string — Unique identifier for this `DocumentMetadata.objectType`. If omitted, this definition is used as a default for all unmatched `DocumentMetadata.objectType`s in this datasource.
    - `displayLabel` string — The user-friendly name of the object for display.
    - `docCategory` 'UNCATEGORIZED' | 'TICKETS' | 'CRM' | 'PUBLISHED_CONTENT' | 'COLLABORATIVE_CONTENT' | 'QUESTION_ANSWER' | 'MESSAGING' | 'CODE_REPOSITORY' | 'CHANGE_MANAGEMENT' | 'PEOPLE' | 'EMAIL' | 'SSO' | 'ATS' | 'KNOWLEDGE_HUB' | 'EXTERNAL_SHORTCUT' | 'ENTITY' | 'CALENDAR' | 'AGENTS' | 'AI_CONVERSATION' | 'AI_ARTIFACT' — The document category of this object type.
    - `propertyDefinitions` PropertyDefinition[]
      - `name` string — The name of the property in the `DocumentMetadata` (e.g. 'createTime', 'updateTime', 'author', 'container'). In the future, this will support custom properties too.
      - `displayLabel` string — The user friendly label for the property.
      - `displayLabelPlural` string — The user friendly label for the property that will be used if a plural context.
      - `propertyType` 'TEXT' | 'DATE' | 'INT' | 'USERID' | 'PICKLIST' | 'TEXTLIST' | 'MULTIPICKLIST' — The type of custom property - this governs the search and faceting behavior. Note that MULTIPICKLIST is not yet supported.
      - `uiOptions` 'NONE' | 'SEARCH_RESULT' | 'DOC_HOVERCARD'
      - `hideUiFacet` boolean — If true then the property will not show up as a facet in the UI.
      - `uiFacetOrder` integer — Will be used to set the order of facets in the UI, if present. If set for one facet, must be set for all non-hidden UI facets. Must take on an integer value from 1 (shown at the top) to N (shown last), where N is the number of non-hidden UI facets. These facets will be ordered below the built-in "Type" and "Tag" operators.
      - `skipIndexing` boolean — If true then the property will not be indexed for retrieval and ranking.
      - `group` string — The unique identifier of the `PropertyGroup` to which this property belongs.
    - `propertyGroups` PropertyGroup[] — A list of `PropertyGroup`s belonging to this object type, which will group properties to be displayed together in the UI.
      - `name` string — The unique identifier of the group.
      - `displayLabel` string — The user-friendly group label to display.
    - `summarizable` boolean — Whether or not the object is summarizable
  - `suggestionText` string — Example text for what to search for in this datasource
  - `homeUrl` string — The URL of the landing page for this datasource instance. Should point to the most useful page for users, not the company marketing page.
  - `crawlerSeedUrls` string[] — This only applies to WEB_CRAWL and BROWSER_CRAWL datasources. Defines the seed URLs for crawling.
  - `iconDarkUrl` string — The URL to an image to be displayed as an icon for this datasource instance in dark mode. Must have a transparency mask. SVG are recommended over PNG. Public, scio-authenticated and Base64 encoded data URLs are all valid (but not third-party-authenticated URLs).
  - `hideBuiltInFacets` string[] — List of built-in facet types that should be hidden for the datasource.
  - `canonicalizingURLRegex` CanonicalizingRegexType[] — A list of regular expressions to apply to an arbitrary URL to transform it into a canonical URL for this datasource instance. Regexes are to be applied in the order specified in this list.
    - `matchRegex` string — Regular expression to match to an arbitrary string.
    - `rewriteRegex` string — Regular expression to transform into a canonical string.
  - `canonicalizingTitleRegex` CanonicalizingRegexType[] — A list of regular expressions to apply to an arbitrary title to transform it into a title that will be displayed in the search results
    - `matchRegex` string — Regular expression to match to an arbitrary string.
    - `rewriteRegex` string — Regular expression to transform into a canonical string.
  - `redlistTitleRegex` string — A regex that identifies titles that should not be indexed
  - `connectorType` 'API_CRAWL' | 'BROWSER_CRAWL' | 'BROWSER_HISTORY' | 'BUILTIN' | 'FEDERATED_SEARCH' | 'PUSH_API' | 'WEB_CRAWL' | 'NATIVE_HISTORY' — The source from which document content was pulled, e.g. an API crawl or browser history
  - `quicklinks` Quicklink[] — List of actions for this datasource instance that will show up in autocomplete and app card, e.g. "Create new issue" for jira
    - `name` string — Full action name. Used in autocomplete.
    - `shortName` string — Shortened name. Used in app cards.
    - `url` string — The URL of the action.
    - `iconConfig` IconConfig — Defines how to render an icon
      - `generatedBackgroundColorKey` string
      - `backgroundColor` string
      - `color` string
      - `key` string
      - `iconType` 'COLLECTION' | 'CUSTOM' | 'DATASOURCE' | 'DATASOURCE_INSTANCE' | 'FAVICON' | 'FILE_TYPE' | 'GENERATED_BACKGROUND' | 'GLYPH' | 'MIME_TYPE' | 'NO_ICON' | 'PERSON' | 'REACTIONS' | 'URL'
      - `masked` boolean — Whether the icon should be masked based on current theme.
      - `name` string — The name of the icon if applicable, e.g. the glyph name for `IconType.GLYPH` icons.
      - `url` string — The URL to an image to be displayed if applicable, e.g. the URL for `iconType.URL` icons.
    - `id` string — Unique identifier of this quicklink
    - `scopes` string[] — The scopes for which this quicklink is applicable
  - `renderConfigPreset` string — The name of a render config to use for displaying results from this datasource. Any well known datasource name may be used to render the same as that source, e.g. `web` or `gdrive`. Please refer to [this](https://developers.glean.com/docs/rendering_search_results/) for more details
  - `aliases` string[] — Aliases that can be used as `app` operator-values.
  - `isOnPrem` boolean — Whether or not this datasource is hosted on-premise.
  - `trustUrlRegexForViewActivity` boolean — True if browser activity is able to report the correct URL for VIEW events. Set this to true if the URLs reported by Chrome are constant throughout each page load. Set this to false if the page has Javascript that modifies the URL during or after the load.
  - `includeUtmSource` boolean — If true, a utm_source query param will be added to outbound links to this datasource within Glean.
  - `stripFragmentInCanonicalUrl` boolean — If true, the fragment part of the URL will be stripped when converting to a canonical url.
  - `identityDatasourceName` string — If the datasource uses another datasource for identity info, then the name of the datasource. The identity datasource must exist already and the datasource with identity info should have its visibility enabled for search results.
  - `productAccessGroup` string — If the datasource uses a specific product access group, then the name of that group.
  - `isUserReferencedByEmail` boolean — whether email is used to reference users in document ACLs and in group memberships.
  - `isEntityDatasource` boolean — True if this datasource is used to push custom entities.
  - `isTestDatasource` boolean — True if this datasource will be used for testing purpose only. Documents from such a datasource wouldn't have any effect on search rankings.

## Response `200`

OK

## Other responses

- `400` — Bad Request
- `401` — Not Authorized

---

[API](https://skmtc.net/gleanwork/apis/glean-indexing-api.md) · [All operations](https://skmtc.net/gleanwork/apis/glean-indexing-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/gleanwork/glean-indexing-api/versions/1c92beda1a4f/schema)
