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,/skillsor/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 --includeRequest body
--datasends 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=5is a number,-F enabled=falseis a boolean), dotted keys build nested objects (-F trigger.type=schedule), and@filereads a file into a string.- When you use both,
--fieldvalues are merged into the--dataobject.
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
You can also use all global options.
See the API reference for the available endpoints.
Last updated on