List Libraries or Create a Library
Resource
HTTP Methods
GET, POST
GET
Get grounding libraries.
- Request parameters for GET
-
Optional filtering by grounding source type is supported.
Parameter Type / Values Description Required Available Version sourceType SFDRIVE, KNOWLEDGE, RETRIEVER, SITEMAP Filter the list by grounding source type. If omitted, all libraries are returned. No 66.0 - Request body
-
None.
- Response body
-
HTTP 200 — LibraryListOutputRepresentation
Property Type Description Available Version libraries array List of LibraryOutputRepresentation summaries. 66.0 totalSize integer Total number of libraries. 66.0 HTTP 403—Insufficient permissions. No response body.
POST
Creates an AI Grounding Library. The source type is inferred from groundingSource (discriminator sourceType, or from populated fields).
Supported source types:
- SFDRIVE — File-based library. After creation, use the file upload workflow.
- KNOWLEDGE — Knowledge article library. Specify knowledgeConfig with required fields.
- RETRIEVER — Connect to an existing custom retriever by providing retrieverId. The retriever must be active; inactive retrievers are rejected with ADL_RETRIEVER_NOT_ACTIVE, and retrievers that can't be located are rejected with ADL_RETRIEVER_NOT_FOUND.
For SFDRIVE, after creation:
- Poll /einstein/data-libraries/{libraryId}/upload-readiness until ready=true (the Unified Data Lake Object must be ACTIVE before upload)
- POST to /einstein/data-libraries/{libraryId}/file-upload-urls with file names to get presigned S3 upload URLs
- PUT files to the presigned URLs
- POST to /einstein/data-libraries/{libraryId}/indexing with uploaded file paths and sizes.
For KNOWLEDGE, provisioning starts automatically after creation. Poll /status to track progress.
For RETRIEVER, the library is immediately usable after creation (no upload workflow required).
- Request body
-
Required. CreateLibraryInputRepresentation
Property Type Description Required Available Version masterLabel string Master label (max 80). Yes 66.0 developerName string Unique developer name (max 80; pattern ^[a-zA-Z][a-zA-Z0-9_]*$). Yes 66.0 description string Description (max 255). No 66.0 dataSpaceScopeId string DataSpaceScope ID; defaults to the org’s default dataspace if omitted. Only the default dataspace is supported. Providing a non-default dataspace ID returns 400 with ADL_NON_DEFAULT_DATASPACE_NOT_SUPPORTED. No 66.0 groundingSource object GroundingSourceInputRepresentation — infers SFDRIVE / KNOWLEDGE / RETRIEVER. No 66.0 GroundingSourceInputRepresentation (polymorphic; sourceType optional, can be inferred):
Property Type Description Available Version sourceType string SFDRIVE, KNOWLEDGE, RETRIEVER, or SITEMAP. 66.0 knowledgeConfig object For KNOWLEDGE: KnowledgeConfigInputRepresentation (primaryIndexField1 and primaryIndexField2 required; optional contentFields, isRestrictToPublicArticle, isDataCategoryRuleEnabled, dataCategorySelectionIds, dataCategorySelectionNames). 66.0 retrieverId string For RETRIEVER: existing retriever ID. 66.0 indexMode string For SFDRIVE: BASIC or ENHANCED. Defaults to BASIC. 66.0 - Response body
-
HTTP 201 — LibraryOutputRepresentation
HTTP 400 — Invalid input.
HTTP 403 — Insufficient permissions.