Skip to Content
CLIapi

flexkit api

Sends an authenticated request to the Flexkit API and prints the response. Use it for endpoints that don’t have a dedicated command yet, or to script against the raw API with your CLI credentials.

Flexkit has two APIs, and flexkit api picks one from the path:

  • Paths that start with /api/ go to the account API, https://api.flexkit.io, for example /api/projects.
  • Every other path goes to the project API of the selected project, https://<projectId>.api.flexkit.io, for example /automations, /skills or /graphql.

JSON responses are printed formatted on stdout, so you can pipe them to jq. When the response status is not 2xx, the body is still printed, and the command exits with code 1.

Synopsis

flexkit api <path> [--method <METHOD>] [--data <body>] [--field <key=value>]... [--query <key=value>]... [--header <name:value>]... [--include] [--project <id>]

Examples

# List the automations of the linked project
flexkit api /automations
 
# Add query string parameters
flexkit api /automations -q enabled=true -q limit=5
 
# List the projects of a team through the account API
flexkit api /api/projects -q scope=acme
 
# Create a skill from fields; @file reads a file into a string field
flexkit api /skills -F name=Refunds -F 'description=How we handle refunds' -F content=@refunds.md
 
# Send a JSON body from a file and keep only the data
flexkit api /graphql --data @query.json | jq .data
 
# Pipe a body in on stdin
echo '{"enabled": false}' | flexkit api /automations/aut_123 -X PATCH --data -
 
# Delete a resource and show the response status and headers
flexkit api /skills/skl_123 -X DELETE --include

Request body

  • --data sends a body as is: inline JSON, @file, or - for stdin.
  • --field key=value (-F) builds a JSON object one field at a time. Values are parsed as JSON when possible (-F limit=5 is a number, -F enabled=false is a boolean), dotted keys build nested objects (-F trigger.type=schedule), and @file reads a file into a string.
  • When you use both, --field values are merged into the --data object.

The method defaults to GET, or POST when the request has a body. Content-Type: application/json is set automatically unless you pass your own with --header.

Options

OptionDescription
-X, --method <METHOD>HTTP method. Defaults to GET, or POST when a body is given.
--data <body>Request body: inline text, @file, or - for stdin.
-F, --field <key=value>Add a JSON body field. Repeatable.
-q, --query <key=value>Add a query string parameter. Repeatable.
-H, --header <name:value>Add a request header. Repeatable.
-i, --includePrint the response status and headers (on stderr) before the body.
-p, --project <id>Project for project API paths. Defaults to the linked project.

You can also use all global options.

See the API reference for the available endpoints.

Last updated on