Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Unable to create an environment variable...


Hi all,

I've tried for probably hours to get the below working but I just can't seem to be able to create an environment variable. The API I'm calling is ...

$ curl -X POST -H "Content-Type: application/json" -H "Authorization: Bearer <token>" -d '{"key": "mytestkey", "value": "value1", "secured": false }'<username>/<repo-slug>/deployments_config/environments/{environment UUID in curly brackets}/variables

The error I get is : 

{"error": {"message": "Not found", "detail": "The value provided is not a valid uuid."}}

The environment UUID I use in the URL is what is returned from a GET on<username>/<repo-slug>/environments/

Can anyone see what I'm doing wrong pls (I think I'm following the API docs at : ). I'm not sure the API docs are strictly correct on that URL above because I don't know how you can include a UUID in the payload when you're creating a variable. 


Many thanks for any help / tips...


2 answers

1 accepted

2 votes
Answer accepted

Hi @curtisa ,

You will need to encode the characters for the curly brackets in order for this to work.

{ should be replaced with %7B and } with %7D

An example call:

curl -X POST -H "Content-Type: application/json" -u username:app-password 
-d '{"key": "mytestkey", "value": "value1", "secured": false }'

where 26e47eac-2770-4b69-8f23-92634d03a443 is the UUID of my Pipelines environment.

Could you please give this a try?

Please feel free to let us know if it works or if you need further assistance.

Kind regards,

Hi Theodora,

Yes that fixed it many thanks.

Kind regards


Hi Alex,

That's good to hear, thank you for the update and you are very welcome!

Kind regards,

1 vote


How did you get the uuid ? 


By calling<username>/<repo-slug>/environments/

and then picking the uuid value of the environment I want to set the variable for, i.e... 

"uuid": "{abcdefg-12345-abcd-1234-abc1234567890}"

Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Bitbucket

New improvements to user management in Bitbucket Cloud 👥

Hey Community! We’re willing to wager that quite a few of you not only use Bitbucket, but administer it too. Our team is excited to share that we’ll be releasing improvements throughout this month of...

3,927 views 10 16
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you