Latchkey
Instructions
Latchkey is a CLI tool that automatically injects credentials into curl commands for supported public APIs. Credentials (mostly API tokens) can be either manually managed or, for some services, Latchkey can open a browser login pop-up window and extract API credentials from the session.
Use this skill when the user asks you to work with third-party services like Slack, Discord, Dropbox, GitHub, Linear and others on their behalf.
Usage:
- Use instead of regular for supported services.
- Pass through all regular curl arguments - latchkey is a transparent wrapper.
- Use to get a list of supported services.
- Use
latchkey services info <service_name>
to get information about a specific service (auth options, credentials status, API docs links, special requirements, etc.).
- If necessary, get or renew credentials first. Run
latchkey auth browser <service_name>
to open a browser login pop-up window if supported.
- Look for the newest documentation of the desired public API online. If using the auth command, avoid bot-only endpoints.
- Do not initiate a new login if the credentials status is - the user might just not have the necessary permissions for the action you're trying to do.
Examples
Make an authenticated curl request
bash
latchkey curl [curl arguments]
Creating a Slack channel
bash
latchkey curl -X POST 'https://slack.com/api/conversations.create' \
-H 'Content-Type: application/json' \
-d '{"name":"my-channel"}'
(Notice that
-H 'Authorization: Bearer
is not present in the invocation.)
Getting Discord user info
bash
latchkey curl 'https://discord.com/api/v10/users/@me'
Detect expired credentials and force a new login to Discord
bash
latchkey services info discord # Check the "credentialStatus" field - shows "invalid"
latchkey auth browser discord
latchkey curl 'https://discord.com/api/v10/users/@me'
Only do this when you notice that your previous call ended up not being authenticated (HTTP 401 or 403).
List available services
Lists all services that latchkey knows about.
Get service-specific info
bash
latchkey services info slack
Returns auth options, credentials status, and developer notes
about the service. If
is not present in the
field, the service requires the user to directly
set API credentials via
or
before making requests.
Notes
- All curl arguments are passed through unchanged
- Return code, stdout and stderr are passed back from curl
Currently supported services
Latchkey currently offers varying levels of support for the
following services: AWS, Calendly, Discord, Dropbox, Figma, GitHub, GitLab,
Gmail, Google Analytics, Google Calendar, Google Docs, Google Drive, Google Sheets,
Linear, Mailchimp, Notion, Sentry, Slack, Stripe, Telegram, Yelp, Zoom, and more.