Request ​Request

yaml
type: "io.kestra.plugin.core.http.request"
yaml
id: api_call
namespace: company.team

tasks:
  - id: basic_auth_api
    type: io.kestra.plugin.core.http.Request
    uri: http://host.docker.internal:8080/api/v1/executions/dev/inputs_demo
    options:
      basicAuthUser: admin
      basicAuthPassword: admin
    method: POST
    contentType: multipart/form-data
    formData:
      user: John Doe

yaml
id: jwt_auth_call
namespace: company.team

tasks:
  - id: auth_token_api
    type: io.kestra.plugin.core.http.Request
    uri: https://dummyjson.com/user/me
    method: GET
    headers:
      Authorization: 'Bearer <TOKEN>'

yaml
id: api_key_auth_call
namespace: company.team

tasks:
  - id: api_key_auth
    type: io.kestra.plugin.core.http.Request
    uri: https://dummyjson.com/user/me
    method: GET
    headers:
      X-API-KEY: abcde12345

yaml
id: api_key_auth_call
namespace: company.team

tasks:
  - id: api_key_in_query_params
    type: io.kestra.plugin.core.http.Request
    uri: "https://dummyjson.com/user/me?api_key={{ secret('API_KEY') }}"
    method: GET

yaml
id: timeout
namespace: company.team

tasks:
  - id: http
    type: io.kestra.plugin.core.http.Request
    uri: https://reqres.in/api/long-request
    timeout: PT10M # no default
    method: GET
    options:
      connectTimeout: PT1M # no default
      readTimeout: PT30S # 10 seconds by default
      connectionPoolIdleTimeout: PT10S # 0 seconds by default
      readIdleTimeout: PT10M # 300 seconds by default

yaml
id: http_post_request_example
namespace: company.team

inputs:
  - id: payload
    type: JSON
    defaults: |
      {"title": "Kestra Pen"}

tasks:
  - id: send_data
    type: io.kestra.plugin.core.http.Request
    uri: https://dummyjson.com/products/add
    method: POST
    contentType: application/json
    body: "{{ inputs.payload }}"

  - id: print_status
    type: io.kestra.plugin.core.log.Log
    message: '{{ outputs.send_data.body }}'

yaml
id: http_post_request_example
namespace: company.team

tasks:
  - id: send_data
    type: io.kestra.plugin.core.http.Request
    uri: "https://server.com/login"
    headers:
      user-agent: "kestra-io"
    method: "POST"
    formData:
      user: "user"
      password: "pass"

yaml
id: http_post_multipart_example
namespace: company.team

inputs:
  - id: file
    type: FILE

tasks:
  - id: send_data
    type: io.kestra.plugin.core.http.Request
    uri: "https://server.com/upload"
    headers:
      user-agent: "kestra-io"
    method: "POST"
    contentType: "multipart/form-data"
    formData:
      user: "{{ inputs.file }}"

yaml
id: http_post_multipart_example
namespace: company.team

inputs:
  - id: file
    type: FILE

tasks:
  - id: send_data
    type: io.kestra.plugin.core.http.Request
    uri: "https://server.com/upload"
    headers:
      user-agent: "kestra-io"
    method: "POST"
    contentType: "multipart/form-data"
    formData:
      user:
        name: "my-file.txt"
        content: "{{ inputs.file }}"

yaml
id: http_upload_image
namespace: company.team

tasks:
  - id: s3_download
    type: io.kestra.plugin.aws.s3.Download
    accessKeyId: "{{ secret('AWS_ACCESS_KEY_ID')}}"
    secretKeyId: "{{ secret('AWS_SECRET_KEY_ID')}}"
    region: "eu-central-1"
    bucket: "my-bucket"
    key: "path/to/file/my_image.jpeg"

  - id: send_data
    type: io.kestra.plugin.core.http.Request
    uri: "https://server.com/upload"
    headers:
      user-agent: "kestra-io"
    method: "POST"
    contentType: "image/jpeg"
    formData:
      user:
        file: "my-image.jpeg"
        url: "{{ outputs.s3_download.uri }}"
        metadata:
          description: "my favorite image"

yaml
id: http_csv_file_upload
namespace: company.team

tasks:
  - id: http_download
    type: io.kestra.plugin.core.http.Download
    uri: https://huggingface.co/datasets/kestra/datasets/raw/main/csv/orders.csv

  - id: upload
    type: io.kestra.plugin.core.http.Request
    uri: "https://server.com/upload"
    headers:
      user-agent: "kestra-io"
    method: "POST"
    contentType: "multipart/form-data"
    formData:
      url: "{{ outputs.http_download.uri }}"

yaml
id: http_multiline_json
namespace: company.team

inputs:
  - id: title
    type: STRING
    defaults: This is the title of the request
  - id: message
    type: STRING
    defaults: |-
      This is my long
      multiline message.
  - id: priority
    type: INT
    defaults: 5

tasks:
  - id: send
    type: io.kestra.plugin.core.http.Request
    uri: "https://reqres.in/api/test-request"
    method: "POST"
    body: |
      {{ {
        "title": inputs.title,
        "message": inputs.message,
        "priority": inputs.priority
      } }}
Properties
Default application/json
Default false
SubType string
Default GET
Default { "followRedirects": "true", "allowFailed": "false", "defaultCharset": "UTF-8" }
SubType array
Format uri
Format duration
Default PT5M
Format duration
Default false
SubType integer
Default UTF-8
Default true
SubType string
Possible Values
REQUEST_HEADERSREQUEST_BODYRESPONSE_HEADERSRESPONSE_BODY
Default DIRECT
Possible Values
DIRECTHTTPSOCKS