Passing environment variables in API v2

Is it possible to pass environment variables in JSON body of API v2 call?

Even with pipelines parameters, I want to use environment variables, so I tried to make api v2 call

https://circleci.com/api/v2/project/:vcs-type/:username/:project/pipeline

and tried something like this to send in body:

    {
    	"branch": "circle_ci_api_v2_test",
    	"parameters": 
    	{
        	"my_mystical_param": "Hello from postman mystic",
        	"my_legendary_param": "Hello from postman legendary"
    	},
    	"build_parameters":{
    		"envVar": "kuku iopta",
        	"testVar1": 27
    	}
    }

But circle ci build does not see any variables

2 Likes

Yup, I have the same question. With API v1.1 I managed to pass some env vars without issues, but it seems that I’m not able to do so in v2. One thing that popped to my mind is to use the env var outside the parameters or build_parameters and put it right under the branch line, but I can’t see it in the other workflow I’m triggering.