> For the complete documentation index, see [llms.txt](https://docs.parameter1.com/basecms-graphql/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.parameter1.com/basecms-graphql/modifying-data/creating-content.md).

# Creating content

## Requirements

{% hint style="info" %}
You'll need the following information to create content via the API:

* An API URL
* A BASE instance URL
* A Tenant Key
* An active BASE user with permission to read and write data

If you're missing any of this information, please reach out to <support@parameter1.com> and we'd be happy to provide it!
{% endhint %}

### Connecting to the API

Connect to the API using a the GraphQL client, programming library, or request utility of your choice. Make sure to send your tenant key along with your request in the `x-tenant-key` HTTP header. For a detailed example, review the [Connecting to the API](/basecms-graphql/connecting-to-the-api.md) guide.

#### Authentication

To modify content, you must first authenticate to the BaseCMS GraphQL API using valid user credentials with access to read and write data. Once complete, send your authentication token along with your request in the `authorization` header (using the `Bearer` prefix). For a detailed example, review the [Authenticating to the API](/basecms-graphql/connecting-to-the-api.md#authenticating-to-the-api) segment of the [Connecting to the API](/basecms-graphql/connecting-to-the-api.md) guide.

#### BASE instance access

In order to route to the correct environment, make sure you send your BASE instance URL along with your request in the `x-base4-api-uri` HTTP header. For a detailed example, review the [Specifying your BASE instance](/basecms-graphql/connecting-to-the-api.md#specifying-your-base-instance) segment of the [Connecting to the API](/basecms-graphql/connecting-to-the-api.md) guide.

## Creating a content item

There are three values required to create a content item:

1. The content item's name
2. The content item's type
3. The content item's primary section

### Name

This one's up to you!

### Type

The type of content you want to create should correlate with the available options within BASE, and should semantically describe your content. For example, when creating a company or company-like content item, use the `Company` content type. For long-form text content, use the `Article` type. For shorter descriptions of current events, use the `News` or `PressRelease` type.&#x20;

Ultimately, the choice is yours, but each content type will have fields specific to its use case.

#### Finding available content types

To see the available content types, review the `ContentType` enum within the GraphQL schema definition. You can find the latest version on the project's Github repository, or via introspection:

![Available ContentType values](/files/-MfDytgHR_hQz2wUJZA6)

#### Viewing fields for a content type

You can see the available fields for each content type by looking them up in the schema:

![The \`ContentPromotion\` schema definition, showing available fields.](/files/-MfDziKOn-0XaOMfhXwP)

#### The Content interface

A `Content<Type>` definition implements one or more content interfaces, the most basic of which is the `Content` interface. All `Content<Type>` definitions will implement this interface, meaning that these fields are available regardless of selected content type.

![The fields defined as part of the \`Content\` interface.](/files/-MfDzs0fDQWVkDBhL4pr)

Other commonly used interfaces include `Authorable` (defining contact/contributor relationships), `Addressable` (defining location fields such as city, region, and postal code), and `Contactable` (defining contact fields, such as phone number and email address).

### Primary Section

Finally, we need to know the "Primary Section" of the content item. Within the BASE ecosystem, all content must have a home when displayed on the website (the final fallback for which is, unsurprisingly, the "Home" website section). When a new BASE instance is provisioned, your selected website sections were made available, along with the `Home` section (and a few others, such as `Authors` or `Contact Us`).

Below, we'll query for our available website sections in order to determine the section ID to use with our query. Once we've identified which section we want our content to be housed under, we'll use this ID to tell BASE where to place the content item upon creation.

![The \`websiteSections\` query, returning the \`id\` field.](/files/-MfE1E7NuJeDdBbMcBT5)

### Putting it all together

Now that we have a name, a type, and a primary section ID, we can use the `createContent` mutation to create the content item via the GraphQL API.

The `createContent` mutation (and other related modifying mutations) require you to send your BASE instance URL along with the request in the `x-base4-uri` HTTP header.

{% hint style="warning" %}
The `createContent` mutation (and other related modifying mutations) require you to send your BASE instance URL along with the request in the `x-base4-api-uri` HTTP header.
{% endhint %}

![Creating a ContentCompany item via the API.](/files/-MfDsh_KLtgqRr8LR7JV)

Now that we've sent our mutation, BASE has returned the new content item -- and most importantly, its `id` field. We can now use that identifier to make changes to the content item, which we'll walk through in the next guide: [Modifying content](/basecms-graphql/modifying-data/modifying-content.md).


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.parameter1.com/basecms-graphql/modifying-data/creating-content.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
