Creating a staging environment

Hi there,

I’m new to DataCMS! I want to create a separate staging environment for our website built with Jekyll and DatoCMS (different deployment, different models etc). I already have a separate deployment on Netlify for the dev branch of our repo. I just created a new ‘staging’ environment on DatoCMS admin dashboard. How do I make the staging deployment on Netlify point to the staging environment (and not the live environment) on DatoCMS? When I go to the API keys section under the staging env, I still see the same API keys (as the ones in the live environment) so I’m a bit confused.

My usecase for creating a new staging env is to safely test new and modified models (changes to our schema).

does doing something like bundler exec dato dump --token=<api_token> --environment=staging work? I tried it out, but seems like it didn’t get the schema changes I made on the admin ui

for context, our deployment of the jekyll site on Netlify uses dato dump to pull content from Dato CMS

Hello @raivat and welcome to the community

Although they do have the same API key, you can specify what environment should be used in the requests by adding a header to your CDA GraphQL requests: Content Delivery API - API endpoint and header modes - DatoCMS Docs
Or, if you are using the CMA (The Rest API) you can use this right here: Using the Javascript client - DatoCMS

In that case, for the dato dump you can specify the environment as such Other SSGs - Integrating with other static generators - DatoCMS Docs

Hi @m.finamor,

Thanks for the detailed info and for welcoming me in this vibrant community! If the --environment flag works, any idea why did it not work when I did bundler exec dato dump --token=<api_token> --environment=staging ?

I added a new field in a model in the staging env via the web UI. If I understand correctly, after adding the field, when I run the dato dump command again, I should see it in the respective .yml file correct?

since I’m using jekyll, would this be affected by the dato.config.rb file?

@raivat The best way to check if you are fetching the new environment would be to create a new record on the new environment, and trying to fetch it using Other SSGs - Accessing records - DatoCMS Docs if you can fetch it, then you can be sure that the flag is working, if not, let us know so we can try and reproduce the issue

Thanks so much for this @m.finamor ! I was able to use this and see a newly created record (on my local jekyll preview). However, I’m confused to see that I can’t find this new field in my local .yaml file. Is that expected behaviour or something is wrong? Thanks!

@raivat great! Regarding the .yaml file, can you send it to us at so we can take a look at it? I can follow up with you there directly :slight_smile:

Thanks! I just sent the email :slight_smile: