Connecting to Contentful
To authenticate to Contentful, you can use API Key authentication to connect to your Contentful space and access your content.
Authentication
To authenticate to Contentful, you can use API Key authentication to connect to your Contentful space and access your content.
Using API Key Authentication
To authenticate using an API Key, you need to obtain your Content Delivery API access token from your Contentful space settings.
You can then connect by setting the AuthScheme to APIKey and providing your API key along with your Space ID:
- AuthScheme: Set this to APIKey.
- APIKey: Set this to your Content Delivery API access token from Contentful.
- SpaceId: Set this to your Contentful Space ID.
- EnvironmentId: Set this to your environment ID (defaults to "master").
Using the Content Management API Token (CMAToken)
The Content Delivery API token (APIKey) grants read-only access and is sufficient for SELECT queries. However, the Assets, Entries, Locales, Tags and ContentTypes tables interact with the Contentful Content Management API to support read and write operations and therefore require an additional CMAToken:
To obtain a CMA token, log in to the Contentful web app, navigate to Settings > CMA tokens, and create a personal access token. Set the CMAToken connection property to this value. The token is sent as a Bearer token in the Authorization header when calling the Content Management API and grants full read/write access to your space, so keep it secret.
Connection String Example
Profile=C:\path\to\Contentful.apip;AuthScheme=APIKey;ProfileSettings="APIKey=your_api_key;EnvironmentId=env_id;SpaceId=your_space_id;";;
Available Tables
The Contentful API Profile provides access to comprehensive content management data across 12 specialized tables:
- Entries - Access content entries with all fields and relationships in your Contentful space.
- Assets - Query media assets with file details and metadata from your Contentful space.
- ContentTypes - Access content type definitions with field schemas for Contentful entries.
- Spaces - Query space information and configuration details.
- Locales - Access locale definitions and language configuration.
- Tags - Query tag definitions and metadata for content organization.
- Concepts - Access concept definitions for content classification.
- ConceptSchemes - Query concept scheme definitions and hierarchies.
- EntryTags - Access relationships between entries and tags.
- EntryConcepts - Query relationships between entries and concepts.
- EntryLinks - Access link relationships between entries.
- SyncChanges - Query synchronization changes and content updates.
Usage Examples
Query entries created after specific date:
SELECT * FROM Entries WHERE CreatedAt >= '2024-01-01T00:00:00Z'
INSERT INTO Entries (Fields, Metadata, ContentTypeId) VALUES ('{"title": {"en-US": "My Article"}, "body": {"en-US": "Content body text"}}', '{"tags": [{"sys": {"type": "Link", "linkType": "Tag", "id": "newTag1"}}]}', '2aTH1MC7CLERc7kRAznXP4')
UPDATE Entries SET Fields = '{"title": {"en-US": "Updated Article"}}' WHERE Id = 'abc123entryid' AND CurrentVersion = 1
Note: The UPDATE endpoint for Entries is an upsert. Always use an existing Id in the WHERE clause — if the specified Id does not exist, a new record will be inserted instead of updated.
DELETE FROM Entries WHERE Id = 'abc123entryid'
Query assets larger than specific size:
SELECT * FROM Assets WHERE Size >= 1000000
INSERT INTO Assets (Fields, Metadata) VALUES ('{"file": {"en-US": {"contentType": "image/jpeg", "fileName": "example.jpeg", "upload": "https://example.com/example.jpg"}}, "title": {"en-US": "Playsam Streamliner"}}', '{"tags": []}')
UPDATE Assets SET Fields = '{"title": {"en-US": "Updated Logo"}}', Metadata = '{"tags": []}' WHERE Id = 'asset-uuid-here' AND CurrentVersion = 1
Note: The UPDATE endpoint for Assets is an upsert. Always use an existing Id in the WHERE clause — if the specified Id does not exist, a new record will be inserted instead of updated.
DELETE FROM Assets WHERE Id = 'asset-uuid-here'
Query all content types:
SELECT * FROM ContentTypes
INSERT INTO ContentTypes (Name, Fields, Description, DisplayField) VALUES ('Blog Post', '[{"id": "title", "name": "Title", "type": "Symbol", "required": true}, {"id": "body", "name": "Body", "type": "Text"}]', 'A blog post content type', 'title')
UPDATE ContentTypes SET Name = 'Blog Post', Description = 'Updated blog post content type', DisplayField = 'title', Fields = '[{"id": "title", "name": "Title", "type": "Symbol", "required": true}]' WHERE Id = 'blogPost' AND CurrentVersion = 1
Note: The UPDATE endpoint for ContentTypes is an upsert. Always use an existing Id in the WHERE clause — if the specified Id does not exist, a new record will be inserted instead of updated.
DELETE FROM ContentTypes WHERE Id = 'blogPost'
Query all spaces:
SELECT * FROM Spaces
Query all locales:
SELECT * FROM Locales
INSERT INTO Locales (Code, Name, FallbackCode) VALUES ('de-DE', 'German (Germany)', 'en-US')
UPDATE Locales SET Code = 'de-DE', Name = 'German (Germany)', FallbackCode = 'en-US' WHERE Id = 'locale-id' AND CurrentVersion = 1
DELETE FROM Locales WHERE Id = 'locale-id'
Query tags by name:
SELECT * FROM Tags WHERE Name = 'technology'
INSERT INTO Tags (Id, Name, Visibility) VALUES ('TagId' , 'NewTag', 'public')
Note: The INSERT endpoint for Tags is an upsert. Always use a new Id while inserting — if the specified Id already exists, the existing record will be updated instead of a new one being inserted.
DELETE FROM Tags WHERE Id = 'newTag1' AND CurrentVersion = 1
Query concepts by preferred label:
SELECT * FROM Concepts WHERE Id = '1JqMcRJZkqGWqGqowaUO4a'
Query specific concept scheme by ID:
SELECT * FROM ConceptSchemes WHERE Id = '1JqMcRJZkqGWqGqowaUO4a'
Query entries with specific tag:
SELECT * FROM EntryTags WHERE TagId = 'nyancat'
Query entries with specific concept:
SELECT * FROM EntryConcepts WHERE ContentType = 'image'
Query entries linking to specific target:
SELECT * FROM EntryLinks WHERE ContentType = 'image'
Query synchronization changes:
SELECT * FROM SyncChanges WHERE Type = 'Entry'
Connection Properties
The connection string properties are the various options that can be used to establish a connection. This section provides a complete list of the options you can configure in the connection string for this provider.
| Property | Description |
| APIKey | Your Contentful Content Delivery API access token. |
| AuthScheme | The scheme used for authentication. Accepted entries are APIKey or None. Allowed values are: BASIC, NONE, NTLM, OAUTH, APIKEY, OAUTH_CLIENT, OAUTH_PASSWORD |
| CMAToken | Your Contentful Content Management API (CMA) personal access token. |
| EnvironmentId | The Environment ID for your Contentful environment. |
| SpaceId | The Space ID for your Contentful space. |