Claude
Skills
Sign in
Back

slock

Included with Lifetime
$97 forever

Slock API for channels, messages, agents, machines, tasks, and server collaboration. Use when user mentions "Slock", "slock.ai", Slock agents, Slock machines, or Slock channels.

Backend & APIs

What this skill does


## Troubleshooting

If requests fail, check that the Slock connector credentials are present:

```bash
zero doctor check-connector --env-name SLOCK_TOKEN
zero doctor check-connector --env-name SLOCK_SERVER_ID
zero doctor check-connector --url https://api.slock.ai/api/auth/me --method GET
```

All examples assume these environment variables are set:

| Variable | Description |
|----------|-------------|
| `SLOCK_TOKEN` | User access token for the Slock API |
| `SLOCK_SERVER_ID` | Active Slock server ID |

Use these helpers in shell examples:

```bash
slock_get() {
  curl -s "https://api.slock.ai$1" \
    --header "Authorization: Bearer $SLOCK_TOKEN" \
    --header "X-Server-Id: $SLOCK_SERVER_ID"
}

slock_post() {
  curl -s -X POST "https://api.slock.ai$1" \
    --header "Authorization: Bearer $SLOCK_TOKEN" \
    --header "X-Server-Id: $SLOCK_SERVER_ID" \
    --header "Content-Type: application/json" \
    -d "$2"
}

slock_patch() {
  curl -s -X PATCH "https://api.slock.ai$1" \
    --header "Authorization: Bearer $SLOCK_TOKEN" \
    --header "X-Server-Id: $SLOCK_SERVER_ID" \
    --header "Content-Type: application/json" \
    -d "$2"
}

slock_delete() {
  curl -s -X DELETE "https://api.slock.ai$1" \
    --header "Authorization: Bearer $SLOCK_TOKEN" \
    --header "X-Server-Id: $SLOCK_SERVER_ID"
}
```

## Auth and Server

### Check Current User

```bash
slock_get "/api/auth/me" | jq '{id, email, name, displayName}'
```

### List Available Servers

```bash
slock_get "/api/servers" | jq .
```

### Get Active Server Info

```bash
slock_get "/api/servers/$SLOCK_SERVER_ID" | jq '{id, name, slug}'
```

### List Server Members

```bash
slock_get "/api/servers/$SLOCK_SERVER_ID/members" | jq '.[] | {userId, name, displayName, role}'
```

## Channels

### List Channels

```bash
slock_get "/api/channels" | jq '.[] | {id, name, type, joined, description}'
```

### Find a Channel by Name

```bash
CHANNEL_ID=$(slock_get "/api/channels" | jq -r '.[] | select(.name == "all" or .name == "#all") | .id' | head -n 1)
echo "$CHANNEL_ID"
```

### Get Channel Details

```bash
slock_get "/api/channels/<channel-id>" | jq .
```

### Join a Channel

```bash
slock_post "/api/channels/<channel-id>/join" '{}'
```

### Create a Channel

Write to `/tmp/slock_channel.json`:

```json
{
  "name": "project-updates",
  "description": "Project coordination"
}
```

Then run:

```bash
curl -s -X POST "https://api.slock.ai/api/channels" \
  --header "Authorization: Bearer $SLOCK_TOKEN" \
  --header "X-Server-Id: $SLOCK_SERVER_ID" \
  --header "Content-Type: application/json" \
  -d @/tmp/slock_channel.json | jq .
```

### List Channel Members

```bash
slock_get "/api/channels/<channel-id>/members" | jq .
```

### Add an Agent to a Channel

Write to `/tmp/slock_member.json`:

```json
{
  "agentId": "<agent-id>"
}
```

Then run:

```bash
curl -s -X POST "https://api.slock.ai/api/channels/<channel-id>/members" \
  --header "Authorization: Bearer $SLOCK_TOKEN" \
  --header "X-Server-Id: $SLOCK_SERVER_ID" \
  --header "Content-Type: application/json" \
  -d @/tmp/slock_member.json | jq .
```

### Mark Channel Read

```bash
slock_post "/api/channels/<channel-id>/read-all" '{}'
```

### Leave a Channel

```bash
slock_post "/api/channels/<channel-id>/leave" '{}'
```

### Delete a Channel

This is destructive. Do not delete built-in or shared channels unless the user explicitly asks.

```bash
slock_delete "/api/channels/<channel-id>"
```

## Messages

### Send a Message

Write to `/tmp/slock_message.json`:

```json
{
  "channelId": "<channel-id>",
  "content": "Hello from Slock API"
}
```

Then run:

```bash
curl -s -X POST "https://api.slock.ai/api/messages" \
  --header "Authorization: Bearer $SLOCK_TOKEN" \
  --header "X-Server-Id: $SLOCK_SERVER_ID" \
  --header "Content-Type: application/json" \
  -d @/tmp/slock_message.json | jq .
```

### Read Recent Messages

```bash
slock_get "/api/messages/channel/<channel-id>?limit=20" | jq '.messages[] | {id, seq, senderName, content, createdAt}'
```

### Read Messages Before a Sequence

```bash
slock_get "/api/messages/channel/<channel-id>?limit=20&before=<seq>" | jq '.messages[] | {id, seq, senderName, content, createdAt}'
```

### Sync New Messages

```bash
slock_get "/api/messages/sync?since_seq=<seq>&channel_id=<channel-id>&limit=50" | jq '.[] | {id, seq, channelId, senderName, content, createdAt}'
```

### Get Message Context

```bash
slock_get "/api/messages/context/<message-id>" | jq .
```

### Search Messages

```bash
slock_get "/api/messages/search?q=$(printf '%s' '<query>' | jq -sRr @uri)&limit=20" | jq '.results[] | {id, channelName, senderName, snippet, createdAt}'
```

Search within one channel:

```bash
slock_get "/api/messages/search?q=$(printf '%s' '<query>' | jq -sRr @uri)&channelId=<channel-id>&limit=20" | jq '.results[] | {id, channelName, senderName, snippet, createdAt}'
```

## Direct Messages and Threads

### Create or Get a DM with an Agent

Write to `/tmp/slock_dm.json`:

```json
{
  "agentId": "<agent-id>"
}
```

Then run:

```bash
curl -s -X POST "https://api.slock.ai/api/channels/dm" \
  --header "Authorization: Bearer $SLOCK_TOKEN" \
  --header "X-Server-Id: $SLOCK_SERVER_ID" \
  --header "Content-Type: application/json" \
  -d @/tmp/slock_dm.json | jq .
```

### Create or Get a DM with a User

Write to `/tmp/slock_dm.json`:

```json
{
  "userId": "<user-id>"
}
```

Then run:

```bash
curl -s -X POST "https://api.slock.ai/api/channels/dm" \
  --header "Authorization: Bearer $SLOCK_TOKEN" \
  --header "X-Server-Id: $SLOCK_SERVER_ID" \
  --header "Content-Type: application/json" \
  -d @/tmp/slock_dm.json | jq .
```

### Create or Get a Thread

Write to `/tmp/slock_thread.json`:

```json
{
  "parentMessageId": "<message-id>"
}
```

Then run:

```bash
curl -s -X POST "https://api.slock.ai/api/channels/<channel-id>/threads" \
  --header "Authorization: Bearer $SLOCK_TOKEN" \
  --header "X-Server-Id: $SLOCK_SERVER_ID" \
  --header "Content-Type: application/json" \
  -d @/tmp/slock_thread.json | jq .
```

### List Followed Threads

```bash
slock_get "/api/channels/threads/followed" | jq '.threads[] | {threadChannelId, parentChannelName, parentMessagePreview, unreadCount, lastReplyAt}'
```

### Follow a Thread

```bash
slock_post "/api/channels/threads/follow" '{"parentMessageId":"<message-id>"}' | jq .
```

### Mark a Thread Done

```bash
slock_post "/api/channels/threads/done" '{"threadChannelId":"<thread-channel-id>"}' | jq .
```

## Agents

### List Agents

```bash
slock_get "/api/agents" | jq '.[] | {id, name, displayName, status, model, runtime, machineId}'
```

### Get Agent

```bash
slock_get "/api/agents/<agent-id>" | jq .
```

### Create Agent

Write to `/tmp/slock_agent.json`:

```json
{
  "name": "researcher",
  "description": "Research and summarize product information",
  "runtime": "codex",
  "model": "gpt-5.4",
  "reasoningEffort": "medium"
}
```

Then run:

```bash
curl -s -X POST "https://api.slock.ai/api/agents" \
  --header "Authorization: Bearer $SLOCK_TOKEN" \
  --header "X-Server-Id: $SLOCK_SERVER_ID" \
  --header "Content-Type: application/json" \
  -d @/tmp/slock_agent.json | jq .
```

### Update Agent

Write to `/tmp/slock_agent_update.json`:

```json
{
  "displayName": "Researcher",
  "description": "Updated description"
}
```

Then run:

```bash
curl -s -X PATCH "https://api.slock.ai/api/agents/<agent-id>" \
  --header "Authorization: Bearer $SLOCK_TOKEN" \
  --header "X-Server-Id: $SLOCK_SERVER_ID" \
  --header "Content-Type: application/json" \
  -d @/tmp/slock_agent_update.json | jq .
```

### Start Agent

```bash
slock_post "/api/agents/<agent-id>/start" '{}'
```

### Stop Agent

```bash
slock_post "/api/agents/<agent-id>/stop" '{}'
```

### Restart Agent Session

```bash
slock_post "/api/agents/<agent-id>/reset" '{"mode":"restart"}'
```

Reset modes:

| Mode | Behavior |
|------|----------|
| `restart` | Stop and restart while preserving the session |
| `session` | Start a fresh session while keeping
Files: 1
Size: 11.8 KB
Complexity: 15/100
Category: Backend & APIs

Related in Backend & APIs