Skip to content
Get a connection

Get a connection

Read the connection a user's calls use for an integration: their own, or the connection of the group their session acts for.

GET/api/v1/users/:userId/connections/:integration

Request#

TypeScript
const response = await fetch("https://api.smallworld.sh/api/v1/users/customer_123/connections/github", {
  method: "GET",
  headers: { Authorization: `Bearer ${apiKey}` },
});
if (!response.ok) throw new Error(`HTTP ${response.status}: ${await response.text()}`);
const result = await response.json();

Use your server-side apiKey. Replace the example IDs.

Path parameters#

userIdstringrequired

Your application's user ID, URL-encoded. At most 512 characters, with no surrounding whitespace or null bytes. Encode the IDs . and .. as %2E and %2E%2E: curl sends these as written, but JavaScript's fetch removes them even when encoded.

integrationstringrequired

An integration key from GET /integrations, such as github or notion.

Query parameters#

groupIdstring

Your application's group ID: which of the user's groups the result is for. Omit it for a user with no group or one group. Required when the user belongs to several groups. URL-encode it.

Responses#

The user's own account. The provider accepted the credentials; secret credential values are never returned.

200 response
{
  "integration": "github",
  "userId": "customer_123",
  "groupId": null,
  "source": "personal",
  "overridesGroup": false,
  "authScheme": "api_key",
  "status": "connected",
  "accountId": "123456",
  "accountName": "octocat",
  "workspaceId": null,
  "connectedAt": "2026-10-10T12:00:01.000Z",
  "updatedAt": "2026-10-10T12:00:01.000Z",
  "error": null
}
More about this endpoint

status is not_connected, with nullable account fields, only when neither the user nor the selected group has a connection. A known user gets this rather than a connection-not-found error.

needs_reauth with source personal means the user should complete a new connect session; the group's connection doesn't replace it meanwhile. With source group, connect the group again.

groupId follows the rules of a new session in POST /worlds/:worldId/execute. Without it, a user with no groups is read without a group and a user with one group is read for that group. A user in several groups needs groupId.