> ## Documentation Index
> Fetch the complete documentation index at: https://docs.nfig.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Create a step workflow session



## OpenAPI

````yaml api-reference/openapi-spec.json post /apis/request/workflow/step/create
openapi: 3.0.0
info:
  title: nFig Agent Backend
  description: nFig Agent Backend
  version: '1.0'
  contact: {}
servers:
  - url: https://api.nfig.ai
    description: Production server
security:
  - bearer: []
tags:
  - name: nFig
    description: ''
paths:
  /apis/request/workflow/step/create:
    post:
      tags:
        - Workflow Step Mode APIs
      summary: Create a step workflow session
      operationId: ExternalApisController_createStepWorkflow
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateStepWorkflowReq'
      responses:
        '200':
          description: Create step workflow session
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CreateStepWorkflowRes'
      security:
        - apiKey: []
      x-codeSamples:
        - lang: curl
          label: cURL
          source: |-
            curl --request POST \
            --url https://api.nfig.ai/apis/request/workflow/step/create \
            --header 'Content-Type: application/json' \
            --header 'api-key: <api-key>' \
            --data '{
              "browserMode": "<mode>"
            }'
        - lang: python
          label: Python
          source: |-
            import requests

            url = "https://api.nfig.ai/apis/request/workflow/step/create"
            headers = {
                "Content-Type": "application/json",
                "api-key": "<api-key>"
            }
            payload = {
                "browserMode": "<mode>"
            }

            response = requests.post(url, headers=headers, json=payload)
            print(response.json())
        - lang: javascript
          label: JavaScript
          source: |-
            const url = 'https://api.nfig.ai/apis/request/workflow/step/create';
            const headers = {
                'Content-Type': 'application/json',
                'api-key': '<api-key>'
            };
            const payload = {
                browserMode: '<mode>'
            };

            fetch(url, {
                method: 'POST',
                headers: headers,
                body: JSON.stringify(payload)
            })
            .then(response => response.json())
            .then(data => console.log(data))
            .catch(error => console.error('Error:', error));
        - lang: php
          label: PHP
          source: |-
            <?php
            $url = "https://api.nfig.ai/apis/request/workflow/step/create";
            $headers = array(
                "Content-Type: application/json",
                "api-key: <api-key>"
            );
            $payload = array(
                "browserMode" => "<mode>"
            );

            $ch = curl_init();
            curl_setopt($ch, CURLOPT_URL, $url);
            curl_setopt($ch, CURLOPT_POST, true);
            curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
            curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($payload));
            curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
            $response = curl_exec($ch);
            curl_close($ch);
            echo $response;
            ?>
        - lang: go
          label: Go
          source: |-
            package main

            import (
                "fmt"
                "strings"
                "net/http"
                "io"
            )

            func main() {
                url := "https://api.nfig.ai/apis/request/workflow/step/create"
                payload := strings.NewReader("{ \"browserMode\": \"<mode>\" }")
                
                req, _ := http.NewRequest("POST", url, payload)
                req.Header.Add("Content-Type", "application/json")
                req.Header.Add("api-key", "<api-key>")
                
                res, _ := http.DefaultClient.Do(req)
                defer res.Body.Close()
                body, _ := io.ReadAll(res.Body)
                
                fmt.Println(res)
                fmt.Println(string(body))
            }
        - lang: java
          label: Java
          source: |-
            import java.io.OutputStream;
            import java.net.HttpURLConnection;
            import java.net.URL;
            import java.nio.charset.StandardCharsets;

            public class WorkflowStepCreate {
                public static void main(String[] args) {
                    try {
                        URL url = new URL("https://api.nfig.ai/apis/request/workflow/step/create");
                        HttpURLConnection conn = (HttpURLConnection) url.openConnection();
                        conn.setRequestMethod("POST");
                        conn.setRequestProperty("Content-Type", "application/json");
                        conn.setRequestProperty("api-key", "<api-key>");
                        conn.setDoOutput(true);
                        
                        String jsonInput = "{\"browserMode\":\"<mode>\"}";
                        try(OutputStream os = conn.getOutputStream()) {
                            byte[] input = jsonInput.getBytes(StandardCharsets.UTF_8);
                            os.write(input, 0, input.length);
                        }
                        
                        int responseCode = conn.getResponseCode();
                        System.out.println("Response Code: " + responseCode);
                        conn.disconnect();
                    } catch(Exception e) {
                        e.printStackTrace();
                    }
                }
            }
components:
  schemas:
    CreateStepWorkflowReq:
      type: object
      properties:
        browserMode:
          type: string
          enum:
            - REMOTE
      required:
        - browserMode
    CreateStepWorkflowRes:
      type: object
      properties:
        workflowId:
          type: string
          description: Workflow Id
          example: 67133e3bdc2f5555ef593
        sessionToken:
          type: string
          description: Session token for current workflow run
        debuggerUrl:
          type: string
          description: Preview url for remote mode
      required:
        - workflowId
        - sessionToken
  securitySchemes:
    apiKey:
      type: apiKey
      in: header
      name: api-key

````