logo

Tembra

Easy integration

Simple API

arrow_back
  • Index
  • Common GraphQL info
  • GraphQL response format
  • CMS GraphQL
    • Article graphql
      • Article graphql
      • Article import graphql
    • Text graphql
    • Page graphql
    • Key-value pairs graphql

GraphQL response format

Request example:

query {
    listTags {
        parentId
    }
}

Valid response example

{
    "data": {
        "listTags": [
            {
                "parentId": "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX"
            },
            {
                "parentId": "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX"
            }
        ]
    },
    "extensions": {
        "timestamp": "2025-09-25T19:19:03.614Z",
        "time": 0.081977
    }
}

The data variable contains the query or mutation response.

The extensions variable contains a timestamp representing the server time and a time representing request duration in seconds.

Invalid/error response example

{
    "errors": [
        {
            "message": "Space missing",
            "locations": [
                {
                    "line": 65,
                    "column": 5
                }
            ],
            "path": [
                "listTags"
            ],
            "extensions": {
                "code": "E_SPACE_MISSING"
            }
        }
    ],
    "data": null,
    "extensions": {
        "timestamp": "2025-09-25T19:26:28.593Z",
        "time": 0.00839
    }
}

The errors variable contains a list of errors. Usually, there is only one.

The extensions.code variable contains error code.

Error codes

{
		'E_UNAUTHORIZED': 'You are not authorized.',
		'E_UNAUTHENTICATED': 'You are not authenticated.',
		'E_SPACE_MISSING': 'Space missing.',
		'E_PROHIBITED': 'Prohibited action.',
		'E_REQUEST_TOO_LONG': 'Request is too long.',


		// ARTICLE
		'E_ARTICLE_UNKNOWN': 'Error in article module.',
		'E_ARTICLE_INTERNAL': 'Error in article module (internal).',
		'E_ARTICLE_TAG_DUPLICATE': "Tag with this name already exists.",
		'E_ARTICLE_TAG_MISSING_PARENT': "Tag cannot be created (missing parent).",
		'E_ARTICLE_TAG_MISSING_SPACE': "Tag cannot be created (missing space).",
		'E_ARTICLE_TAG_MISSING_NAME': "Tag cannot be created (missing name).",
		'E_ARTICLE_TAG_INVALID_PARENT': "Invalid tag parent.",

		'E_ARTICLE_ARTICLE_DUPLICATE': "Article with this name already exists.",
		'E_ARTICLE_ARTICLE_MISSING_PARENT': "Article cannot be created (missing parent).",
		'E_ARTICLE_ARTICLE_MISSING_SPACE': "Article cannot be created (missing space).",
		'E_ARTICLE_ARTICLE_MISSING_NAME': "Article cannot be created (missing name).",
		'E_ARTICLE_ARTICLE_MISSING_TAG': "Article tag does not exists.",

		'E_ARTICLE_VERSION_DUPLICATE': "Duplicate article version.",
		'E_ARTICLE_VERSION_MISSING_ARTICLE': "Article version cannot be created (missing article).",
		'E_ARTICLE_VERSION_DUPLICATE_URL': "URL already taken by different article.",

		'E_ARTICLE_COMMENT_DUPLICATE': "Duplicate article comment.",
		'E_ARTICLE_COMMENT_MISSING_PARENT': "Article comment cannot be created (missing parent).",
		'E_ARTICLE_COMMENT_MISSING_ARTICLE': "Article comment cannot be created (missing article).",
		'E_ARTICLE_COMMENT_MISSING_SPACE': "Article comment cannot be created (missing space).",
		'E_ARTICLE_COMMENT_MISSING_USER': "Article comment cannot be created (missing user).",
		'E_ARTICLE_COMMENT_INVALID_STATE': "Article comment cannot be changed (wrong state).",


		// FILE
		'E_FILE_UNKNOWN': 'Error in file module.',
		'E_FILE_INTERNAL': 'Error in file module (internal).',
		'E_FILE_DUPLICATE': "File with this name already exists.",
		'E_FILE_MISSING_PARENT': "File cannot be created (missing parent).",
		'E_FILE_MISSING_SPACE': "File cannot be created (missing space).",
		'E_FILE_MISSING_NAME': "File cannot be created (missing name).",

		'E_FILE_FOLDER_DUPLICATE': "Folder with this name already exists.",
		'E_FILE_FOLDER_MISSING_PARENT': "Folder cannot be created (missing parent).",
		'E_FILE_FOLDER_MISSING_SPACE': "Folder cannot be created (missing space).",
		'E_FILE_FOLDER_MISSING_NAME': "Folder cannot be created (missing name).",
		'E_FILE_FOLDER_CANNOT_MOVE': "Folder cannot be moved.",
		'E_FILE_FOLDER_CANNOT_DELETE': "Folder cannot be deleted.",

		// KEY-VALUE
		'E_KEYVALUE_UNKNOWN': 'Error in key-value module.',
		'E_KEYVALUE_INTERNAL': 'Error in key-value module (internal).',
		'E_KEYVALUE_KEYVALUE_DUPLICATE': "Key-value pair with this name already exists.",
		'E_KEYVALUE_KEYVALUE_MISSING_PARENT': "Key-value pair cannot be created (missing parent).",
		'E_KEYVALUE_KEYVALUE_MISSING_SPACE': "Key-value pair cannot be created (missing space).",
		'E_KEYVALUE_KEYVALUE_MISSING_NAME': "Key-value pair cannot be created (missing name).",

		'E_KEYVALUE_VERSION_DUPLICATE': "Duplicate key-value pair version.",
		'E_KEYVALUE_VERSION_MISSING_PARENT': "Key-value pair version cannot be created (missing parent).",

		// ORGANIZATION

		'E_ORGANIZATION_UNKNOWN':  'Error in organization module.',
		'E_ORGANIZATION_INTERNAL': 'Error in organization module (internal).',
		'E_ORGANIZATION_DUPLICATE': 'Duplicate organization.',
		'E_ORGANIZATION_MISSING_PARENT': 'Organization cannot be created (missing parent).',
		'E_ORGANIZATION_MISSING_SPACE': 'Space does not exists.',
		'E_ORGANIZATION_MISSING_USER': 'User does not exists.',
		'E_ORGANIZATION_MISSING_NAME': 'Missing name.',


		// PAGE
		'E_PAGE_UNKNOWN': 'Error in page module.',
		'E_PAGE_INTERNAL': 'Error in page module (internal).',
		'E_PAGE_PAGE_DUPLICATE': "Page with this name already exists.",
		'E_PAGE_PAGE_MISSING_PARENT': "Page pair cannot be created (missing parent).",
		'E_PAGE_PAGE_MISSING_SPACE': "Page cannot be created (missing space).",
		'E_PAGE_PAGE_MISSING_NAME': "Page cannot be created (missing name).",

		'E_PAGE_VERSION_DUPLICATE': "Duplicate page version.",
		'E_PAGE_VERSION_MISSING_PAGE': "Page version cannot be created (missing page).",
		'E_PAGE_VERSION_DUPLICATE_URL': "URL already taken by different page.",


		// PAYMENT
		'E_PAYMENT_UNKNOWN': 'Error in payment module.',
		'E_PAYMENT_INTERNAL': 'Error in payment module (internal).',
		'E_PAYMENT_DUPLICATE': 'Duplicate payment.',
		'E_PAYMENT_NOT_EXISTS': 'Payment does not exists.',
		'E_PAYMENT_ALREADY_PAID': 'Payment already paid.',
		'E_PAYMENT_PAYPAL_AUTH_TOKEN': 'Cannot generate PayPal token.',
		'E_PAYMENT_PAYPAL_BROWSER_TOKEN': 'Cannot generate PayPal browser token.',
		'E_PAYMENT_PAYPAL_PAYMENT': 'Cannot generate PayPal token.',
		'E_PAYMENT_PAYPAL_PAYMENT_CREATE': 'Cannot create PayPal payment.',
		'E_PAYMENT_PAYPAL_PAYMENT_CAPTURE': 'Cannot capture PayPal payment.',
		'E_PAYMENT_PAYPAL_NOT_EXISTS': 'PayPal payment does not exist.',


		// SPACE
		'E_SPACE_UNKNOWN': 'Error in space module.',
		'E_SPACE_INTERNAL': 'Error in space module (internal).',
		'E_SPACE_DUPLICATE': "Space with this name already exists.",
		'E_SPACE_MISSING_PARENT': "Space cannot be created (missing parent).",
		'E_SPACE_MISSING_NAME': "Space cannot be created (missing name).",
		'E_SPACE_INVALID_SETTINGS': 'Space settings data are not valid.',
		'E_SPACE_MISSING_USER': 'User does not exists.',



		// TEXT
		'E_TEXT_UNKNOWN': 'Error in text module.',
		'E_TEXT_INTERNAL': 'Error in text module (internal).',
		'E_TEXT_TEXT_DUPLICATE': "Text with this name already exists.",
		'E_TEXT_TEXT_MISSING_PARENT': "Text cannot be created (missing parent).",
		'E_TEXT_TEXT_MISSING_SPACE': "Text cannot be created (missing space).",
		'E_TEXT_TEXT_MISSING_NAME': "Text cannot be created (missing name).",
		'E_TEXT_TEXT_MISSING_CATEGORY': "Category does not exists.",

		'E_TEXT_CATEGORY_DUPLICATE': "Category with this name already exists.",
		'E_TEXT_CATEGORY_MISSING_PARENT': "Category cannot be created (missing parent).",
		'E_TEXT_CATEGORY_MISSING_SPACE': "Category cannot be created (missing space).",
		'E_TEXT_CATEGORY_MISSING_NAME': "Category cannot be created (missing name).",

		'E_TEXT_VERSION_DUPLICATE': "Duplicate text version.",
		'E_TEXT_VERSION_MISSING_TEXT': "Text version cannot be created (missing text).",


		// USER
		'E_USER_UNKNOWN': 'Error in user module.',
		'E_USER_INTERNAL': 'Error in user module (internal).',
		'E_USER_DUPLICATE': "User with this name already exists.",

		'E_USER_MISSING_LOGIN': "Login is missing.",
		'E_USER_MISSING_PASSWORD': "Password is missing.",
		'E_USER_PASSWORD_FORMAT': "Wrong password format.",


		// USER PROFILE
		'E_USERPROFILE_UNKNOWN': 'Error in user profile module.',
		'E_USERPROFILE_INTERNAL': 'Error in user profile module (internal).',
		'E_USERPROFILE_MISSING_PARENT': "User profile cannot be created (missing parent).",
		'E_USERPROFILE_MISSING_USER': "User profile cannot be created (missing user).",


		// USER SETTINGS
		'E_USERSETTINGS_UNKNOWN': 'Error in user settings module.',
		'E_USERSETTINGS_INTERNAL': 'Error in user settings module (internal).',


	}				

Common GraphQL information

ISO Date time

Date and time information (createdAt etc.) is passed in a simplified ISO 8601-based format. See Date.prototype.toISOString() for more information.

Null parameter for listing and searching

If the parameter is nullable in the listing or search, the parameter is ignored if it is set to null. The exception is the "count" parameter, which defaults to 100 items.

@space directive

The "@space" directive in a call indicates that the "X-WNT-SPACE-ID" header must be set to the ID of the space you are working with. You can find the Space ID on the Space page in the application.

@apiKey directive

The "@apiKey" directive in a call indicates that the "X-WNT-API-KEY" header must be set to the API key of the space you are working with. You can find the Space API key on the Space page in the application.

CMS GraphQL information

Language and country for listing and searching

Language and country parameters for listing and searching are:

# language / country parameter
input LanguageCountry {

	# language code
	language: String

	# country code
	country: String

}

# input for page versions listing
input PageVersionListInput {
	# language / country filters for listing
	languageCountry: [LanguageCountry!]

	# if true, listing will return all versions in languageCountry parameter
	# if false, listing will return only first found version for languageCountry parameter
	languageCountryAll: Boolean
}

An example of usage would be:

query {
	listKeyValues(data: {name: ["article"]}) {
		id
		name
		# parentId
		fullVersions(data: {
			languageCountry: [
				{language: "cs", country: "cz"},
				{language: "cs", country: ""},
				{ language: "cs" }
			]
		}) {
			pairs {
				name
				value
			}
		}
	}
}

The above example means, "Give me the cs language version for the cz country first." If that does not exist, look for the default cs language version (country: ""), and if that does not exist, give me any cs language version.

The listing/search looks for matching version in the order specified in languageCountry parameter.

If the languageCountryAll parameter is set to true, all versions in the list that exist are returned.

Published for listing and searching

If the published parameter for listing and searching is set to true, then the data must be set to published and the current date and time must be greater than or equal to the publishedFrom data. It must also be less than the publishedTo data, or the publishedTo data must not be set.

If the published parameter for listing and searching is set to false, the previous statement must not be true.

If published is not used or is set to null, the published parameters are ignored.

Versions vs fullVersions

Every basic representation of data (article, text, page, key-value pair) contains versions and fullVersions fields. The fullVersions field contains all version data, but the versions field is faster. Choose wisely.

Documentation

This documentation describes the public API for accessing data stored in Tembra.

Pages GraphQL

API endpoint: https://api.tembra.app/public/cms/graphql/page



########################################
# PAGES
########################################

# language / country parameter
input LanguageCountry {

	# language code
	language: String

	# country code
	country: String

}

# input for page versions listing
input PageVersionListInput {
	# language / country filters for listing
	languageCountry: [LanguageCountry!]

	# if true, listing will return all versions in languageCountry parameter
	# if false, listing will return only first found version for languageCountry parameter
	languageCountryAll: Boolean

	# if true, listing will return only published versions
	# if false, listing will return only unpublished versions
	published: Boolean
}

# page representation
type Page {

	# Page.id
	id: String!

	# page name
	name: String!

	# Space.pageParentId
	parentId: String!

	# date and time when page was created
	createdAt: String!

	# date and time when page last updated
	updatedAt: String!

	# list of File.id
	files: [String!]!

	# whether page is published
	published: Boolean!

	# date and time since the page is published
	publishedFrom: String!

	# date and time until the page is published
	publishedTo: String

	# listing function for full page versions
	fullVersions(data: PageVersionListInput): [PageVersion!]!

	# listing function for versions information list
	versions: [PageVersionBase!]!
}

# input for page listing
input ListPagesInput {

	# pages names
	name: [String!]

	# listing offset
	start: Int

	# listing count
	count: Int

}

########################################
# VERSION
########################################

# basic information about page version
type PageVersionBase {

	# version id
	id: String!

	# language code
	language: String!

	# country code
	country: [String!]!

	# date and time when record was created
	createdAt: String!

	# date and time when record last updated
	updatedAt: String!

	# whether page version published parameters
	# are copied from parent page
	publishedAsParent: Boolean!

	# whether page version is published
	published: Boolean!

	# date and time since the page version is published
	publishedFrom: String!

	# date and time until the page version is published
	publishedTo: String

}

type PageVersion {

	# version id
	id: String!

	# Page.id
	parentId: String!

	# language code
	language: String!

	# country code
	country: [String!]!

	# date and time when page version was created
	createdAt: String!

	# date and time when page version last updated
	updatedAt: String!

	# page version title
	title: String!

	# page version URL
	url: String!

	# page version text
	text: String!

	# page version description
	description: String!

	# page version keywords
	keywords: String!

	# og:description tag
	ogDescription: String!

	# og:title tag
	ogTitle: String!

	# og:image tag
	ogImage: String!

	# whether page version published parameters
	# are copied from parent page
	publishedAsParent: Boolean!

	# whether page version is published
	published: Boolean!

	# date and time since the page version is published
	publishedFrom: String!

	# date and time until the page version is published
	publishedTo: String

}

# listing sort
enum ListPageVersionsSort {

	# sort by title
  title

	# sort by
	published

}

input ListPageVersionsInput {

	# language / country filters for listing
	languageCountry: [LanguageCountry!]

	# if true, listing will return all versions in languageCountry parameter
	# if false, listing will return only first found version for languageCountry parameter
	languageCountryAll: Boolean

	# if true, listing will return only published versions
	# if false, listing will return only unpublished versions
	published: Boolean

	# page ID
	parentId: String

	#page version title
	title: String

	#page version URL
	url: String

	# sort by
	sort: ListPageVersionsSort

	#sort direction
	sortDirection: Int

	# listing start
	start: Int

	# listing count
	count: Int
}

########################################
# SCHEMA
########################################

type Query {
	# PING API
	ping: Boolean!

	# function to list pages
	listPages(data: ListPagesInput!): [Page!]! @space

	# list page versions
	listPageVersions(data: ListPageVersionsInput!): [PageVersion!]! @space

}

schema {
	query: Query
}

Key - values GraphQL

API endpoint: https://api.tembra.app/public/cms/graphql/keyValue


########################################
# KEYVALUE
########################################

# language / country parameter
input LanguageCountry {

	# language code
	language: String

	# country code
	country: String

}

# key-value pairs listing input data
input KeyValueVersionListInput {

	# language / country filters for listing
	languageCountry: [LanguageCountry!]

	# if true, listing will return all versions in languageCountry parameter
	# if false, listing will return only first found version for languageCountry parameter
	languageCountryAll: Boolean

}

# key-value pair representation
type KeyValue {

	# ID
	id: String!

	# name
	name: String!

	# (Space.keyValueParentId)
	parentId: String!

	# date and time when record was created
	createdAt: String!

	# date and time when record last updated
	updatedAt: String!

	# listing function for full key-value versions
	fullVersions(data: KeyValueVersionListInput): [KeyValueVersion!]!

	# listing function for versions information list
	versions: [KeyValueVersionBase!]!
}

enum ListKeyValuesSort {

	#sort by name
	name

}

# input for key-value listing
input ListKeyValuesInput {

	# list of names to list
	name: [String!]

	# listing offset
	start: Int

	# listing count
	count: Int

	# sort field (name)
	sort: ListKeyValuesSort

	# sort direction (1 = ascending, -1 = descending)
	sortDirection: Int
}

########################################
# VERSION
########################################

# key-value pair data
type KeyValuePair {

	# key
	name: String!

	# value
	value: String!

}

# basic information of version
type KeyValueVersionBase {

	# version id
	id: String!

	# language code
	language: String!

	# country code
	country: [String!]!

	# date and time when record was created
	createdAt: String!

	# date and time when record last updated
	updatedAt: String!

}


type KeyValueVersion {

	# version id
	id: String!

	# KeyValue.id
	parentId: String!

	# language code
	language: String!

	# country code
	country: [String!]!

	# date and time when record was created
	createdAt: String!

	# date and time when record last updated
	updatedAt: String!

	# list of key-value pairs
	pairs: [KeyValuePair!]!

}


########################################
# SCHEMA
########################################

type Query {

	# ping API
	ping: Boolean!

	# list key-values
	listKeyValues(data: ListKeyValuesInput!): [KeyValue!]! @space

}

schema {
	query: Query
}

Article GraphQL

API endpoint: https://api.tembra.app/public/cms/graphql/article


########################################
# TAGS
########################################

# language / country version of tag
type TagContent {

	# language code
	language: String!

	# translation
	data: String!

}

#tag
type Tag {

	# tag ID
	id: String!

	# tag name
	name: String!

	# tag parent (either Space.articleParentId or Tag.id)
	parentId: String!

	# list of traslations
	content: [TagContent!]!

}

########################################
# ARTICLES
########################################

type ArticleComments {

	# number of all comments
	all: Int!

	# number of new comments
	new: Int!

	# number of valid comments
	valid: Int!

	# number of junk comments
	junk: Int!

	# number of valid comments in comments tree
	validTree: Int!
}

# language / country parameter
input LanguageCountry {

	# language code
	language: String

	# country code
	country: String

}

# input for article versions listing
input ArticleVersionListInput {

	# language / country filters for listing
	languageCountry: [LanguageCountry!]

	# if true, listing will return all versions in languageCountry parameter
	# if false, listing will return only first found version for languageCountry parameter
	languageCountryAll: Boolean

	# if true, listing will return only published versions
	# if false, listing will return only unpublished versions
	published: Boolean

}

# representation of Article
type Article {

	# article ID
	id: String!

	# article name
	name: String!

	# article parent id (Space.articleParentId)
	parentId: String!

	# date and time when article was created
	createdAt: String!

	# date and time when article last updated
	updatedAt: String!

	# list of Tag.id
	tags: [String!]!

	# list of File.id
	files: [String!]!

	# whether article is published
	published: Boolean!

	# date and time since the article is published
	publishedFrom: String!

	# date and time until the article is published
	publishedTo: String

	# listing function for full article versions
	fullVersions(data: ArticleVersionListInput): [ArticleVersion!]!

	# listing function for versions information list
	versions: [ArticleVersionBase!]!

	# number of comments
	commentCount: ArticleComments!

}

# input for article listing
input ListArticlesInput {

	# whether article is published
	# published, publishedFrom and publishedTo are taken into account
	published: Boolean

	# listing offset
	start: Int

	# listing count
	count: Int

	# sort field (name | published)
	sort: String

	# sort direction (1 = ascending, -1 = descending)
	sortDirection: Int

	# list of Tag.id to filter by
	tags: [String!]

}

########################################
# VERSION
########################################

# basic information about article version
type ArticleVersionBase {

	#	version ID
	id: String!

	# language code
	language: String!

	# country code
	country: [String!]!

	# date and time when article version was created
	createdAt: String!

	# date and time when article version last updated
	updatedAt: String!


	# whether article version published parameters
	# are copied from parent article
	publishedAsParent: Boolean!

	# whether article version is published
	published: Boolean!

	# date and time since the article version is published
	publishedFrom: String!

	# date and time until the article version is published
	publishedTo: String

}

# full article version
type ArticleVersion {

	#	version ID
	id: String!

	# Article.id
	parentId: String!

	# language code
	language: String!

	# country code
	country: [String!]!

	# date and time when article version was created
	createdAt: String!

	# date and time when article version last updated
	updatedAt: String!

	# article version title
	title: String!

	# article version URL
	url: String!

	# article version perex
	perex: String!

	# article version text
	text: String!

	# article version description
	description: String!

	# article version keywords
	keywords: String!

	# og:description tag
	ogDescription: String!

	# og:title tag
	ogTitle: String!

	# og:image tag
	ogImage: String!

	# perex image URL
	perexImage: String!

	# whether article version published parameters
	# are copied from parent article
	publishedAsParent: Boolean!

	# whether article version is published
	published: Boolean!

	# date and time since the article version is published
	publishedFrom: String!

	# date and time until the article version is published
	publishedTo: String

	# number of comments
	commentCount: ArticleComments!

}


########################################
# COMMENT
########################################

# comment state
enum CommentState {

	# new comment
  new

	# comment validated in administration
	valid

	# comment marked as junk
	junk

}

# custom comment field
type CommentField {

	# custom field name
	name: String!

	# custom field value
	value: String!

}

# comment
type Comment {

	# Comment.id
	id: String!

	# Space.id
	spaceId: String!

	# Artcile.id
	articleId: String!

	# parent Comment.id (this is a response)
	parentId: String

	# User.id
	userId: String

	# numeric representation of comemnts tree structure
	# 00000008.00000015.00000002 would represent second answer to 15th answer to 8th comment
	levelIdent: String!

	# language code
	language: String!

	# article version ID
	versionId: String!

	# date and time when comment version was created
	createdAt: String!

	# date and time when comment version last updated
	updatedAt: String!

	# comment state
	state: CommentState!

	# comment's subject
	subject: String!

	# comment's text
	text: String!

	# comment's additional fields
	fields: [CommentField!]

}

# custom comment field
input CommentFieldInput {

	# custom field name
	name: String!

	# custom field value
	value: String!

}

# create comment input data
input CreateCommentInput {

	# article version ID
	versionId: String!

	# Comment.id
	parentId: String

	# comment's subject
	subject: String!

	# comment's text
	text: String!

	# comment's additional fields
	fields: [CommentFieldInput!]!

}

# list comments input data
input ListCommentsInput {

	# Article.id
	articleId: String!

	# Comment.id
	parentId: String

	# language code
	language: String

	# article version ID
	versionId: String!

	# whether to include answers as well (all levels)
	includeChildren: Boolean

	# comment state
	state: [CommentState!]

	# listing offset
	start: Int

	# listing count
	count: Int

}

# comment listing result paging info
type ListResultListing {

	# total number of items
	itemsCount: Int!

	# listing start (from request)
	start: Int!

	# listing count (from request)
	count: Int!
}

# comment listing result
type ListCommentsResult {

	# comment items
	items: [Comment!]!

	# pagination info
	listing: ListResultListing!
}

########################################
# VERSION
########################################

enum SearchArticleVersionsSort {

	# sort by published and publishedFrom fields
  published

	# sort by search score
	searchScore

	# sort by version title
	title

}


# list article versions based on search
input SearchArticleVersionsInput {

	# text to search
	search: String

	# list of Tag.id to filter by
	tags: [String!]

	# article version URL to filter by
	url: String

	# language / country filters for listing
	languageCountry: [LanguageCountry!]

	# if true, listing will return all versions in languageCountry parameter
	# if false, listing will return only first found version for languageCountry parameter
	languageCountryAll: Boolean

	# whether article is published
	# published, publishedFrom and publishedTo are taken into account
	published: Boolean

	# listing offset
	start: Int

	# listing count
	count: Int

	# sorting property
	sort: SearchArticleVersionsSort

	# sorting direction, 1 = ascending, -1 = descending
	sortDirection: Int

}


# full article version
type FoundArticleVersion {

	#	version ID
	id: String!

	# Article.id
	parentId: String!

	# language code
	language: String!

	# country code
	country: [String!]!

	# date and time when article version was created
	createdAt: String!

	# date and time when article version last updated
	updatedAt: String!

	# article version title
	title: String!

	# article version URL
	url: String!

	# article version perex
	perex: String!

	# article version text
	text: String!

	# article version description
	description: String!

	# article version keywords
	keywords: String!

	# og:description tag
	ogDescription: String!

	# og:title tag
	ogTitle: String!

	# og:image tag
	ogImage: String!

	# perex image URL
	perexImage: String!

	# whether article version published parameters
	# are copied from parent article
	publishedAsParent: Boolean!

	# whether article version is published
	published: Boolean!

	# date and time since the article version is published
	publishedFrom: String!

	# date and time until the article version is published
	publishedTo: String

	# number of comments
	commentCount: ArticleComments!

	# search score
	searchScore: Float!

	# list of Tag.id
	tags: [String!]!


}

# artcile version listing result
type SearchArticleVersionsResult {

	# artcile version items
	items: [FoundArticleVersion!]!

	# pagination info
	listing: ListResultListing!
}


########################################
# SCHEMA
########################################

type Query {

	# PING API
	ping: Boolean!

	# get article by ID
	getArticle(id: String!): Article @space

	# list articles
	listArticles(data: ListArticlesInput!): [Article!]! @space

	# list tags
	listTags: [Tag!]! @space

	# list article comments
	listComments(data: ListCommentsInput!):ListCommentsResult! @space

	# list article versions based on search
	searchArticleVersions(data: SearchArticleVersionsInput!): SearchArticleVersionsResult! @space

}

type Mutation {

	# create article comment
	createComment(data: CreateCommentInput!): String! @space

}

schema {
	query: Query
	mutation: Mutation
}

Article import GraphQL

API endpoint: https://api.tembra.app/public/cms/graphql/article


########################################
# TAGS
########################################

# language / country version of tag
input ImportTagContentInput {

	# language code
	language: String!

	# translation
	data: String!

}

#tag
input ImportTagInput {

	# tag name
	name: String!

	# tag parent (either Space.articleParentId or Tag.id)
	parentId: String

	# list of traslations
	content: [ImportTagContentInput!]!

}

########################################
# ARTICLES
########################################


########################################
# VERSION
########################################



########################################
# SCHEMA
########################################

type Mutation {

	# create tag
	importTag(data: ImportTagInput!): String! @apiKey @space

}

schema {
	mutation: Mutation
}

Text GraphQL

API endpoint: https://api.tembra.app/public/cms/graphql/text


########################################
# CATEGORIES
########################################


########################################
# TEXT
########################################

# language / country parameter
input LanguageCountry {

	# language code
	language: String

	# country code
	country: String

}


# input for article versions listing
input TextVersionListInput {

	# language / country filters for listing
	languageCountry: [LanguageCountry!]

	# if true, listing will return all versions in languageCountry parameter
	# if false, listing will return only first found version for languageCountry parameter
	languageCountryAll: Boolean

}

type Text {

	# Text.id
	id: String!

	# text name
	name: String!

	# text parent id (Space.textParentId)
	parentId: String!

	# date and time when text was created
	createdAt: String!

	# date and time when text last updated
	updatedAt: String!

	# list of File.id
	files: [String!]!

	# category ID
	categoryId: String!

	# listing function for full text versions
	fullVersions(data: TextVersionListInput): [TextVersion!]!

	# listing function for versions information list
	versions: [TextVersionBase!]!
}

enum ListTextsSort {

	#sort by name
	name

}

# input for text listing
input ListTextsInput {

	# list of text names to list
	name: [String!]

	# list of category IDs to list texts from
	categoryId: [String!]

	# list of category names to list texts from
	categoryName: [String!]

	# listing offset
	start: Int

	# listing count
	count: Int

	# sort field (name)
	sort: ListTextsSort

	# sort direction (1 = ascending, -1 = descending)
	sortDirection: Int

}

########################################
# VERSION
########################################

# basic information about text version
type TextVersionBase {

	# version id
	id: String!

	# language code
	language: String!

	# country code
	country: [String!]!

	# date and time when article version was created
	createdAt: String!

	# date and time when article version last updated
	updatedAt: String!

}

# Text version representation
type TextVersion {

	# version id
	id: String!

	# Text.id
	parentId: String!

	# language code
	language: String!

	# country code
	country: [String!]!

	# date and time when article version was created
	createdAt: String!

	# date and time when article version last updated
	updatedAt: String!

	# text title
	title: String!

	#text data
	text: String!

}


########################################
# SCHEMA
########################################

type Query {

	# PING API
	ping: Boolean!

	# function to list texts
	listTexts(data: ListTextsInput!): [Text!]! @space
}


schema {
	query: Query
}