# Connections

## Get connections for a URL

> Returns connections where the given URL is the source or target, optionally filtered by direction and type.

```json
{"openapi":"3.0.2","info":{"title":"Semble API","version":"1.0.0"},"servers":[{"url":"https://api.semble.so/xrpc"}],"paths":{"/network.cosmik.connection.getForUrl":{"get":{"description":"Returns connections where the given URL is the source or target, optionally filtered by direction and type.","summary":"Get connections for a URL","tags":["connections"],"parameters":[{"name":"page","in":"query","schema":{"type":"number","nullable":true}},{"name":"limit","in":"query","schema":{"type":"number","nullable":true}},{"name":"sortBy","in":"query","schema":{"type":"string"}},{"name":"sortOrder","in":"query","schema":{"type":"string","enum":["asc","desc"]}},{"name":"url","in":"query","required":true,"schema":{"type":"string"}},{"name":"direction","in":"query","schema":{"type":"string","enum":["forward","backward","both"]}},{"name":"connectionTypes","in":"query","schema":{"type":"array","items":{"type":"string","enum":["SUPPORTS","OPPOSES","ADDRESSES","HELPFUL","LEADS_TO","RELATED","SUPPLEMENT","EXPLAINER"]}}}],"operationId":"connectionsForUrl","responses":{"200":{"description":"200","content":{"application/json":{"schema":{"type":"object","properties":{"connections":{"type":"array","items":{"type":"object","properties":{"connection":{"type":"object","properties":{"id":{"type":"string"},"type":{"type":"string"},"note":{"type":"string"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"curator":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"handle":{"type":"string"},"avatarUrl":{"type":"string"},"bannerUrl":{"type":"string"},"description":{"type":"string"},"isFollowing":{"type":"boolean"},"followsYou":{"type":"boolean"},"followerCount":{"type":"number"},"followingCount":{"type":"number"},"followedCollectionsCount":{"type":"number"},"urlCardCount":{"type":"number"},"collectionCount":{"type":"number"},"connectionCount":{"type":"number"},"connectionsByType":{"type":"object","properties":{"total":{"type":"number"}},"required":["total"],"additionalProperties":{"type":"number"}},"labels":{"type":"array","items":{"type":"object","properties":{"$type":{"type":"string","enum":["com.atproto.label.defs#label"]},"ver":{"type":"number"},"src":{"type":"string"},"uri":{"type":"string"},"cid":{"type":"string"},"val":{"type":"string"},"neg":{"type":"boolean"},"cts":{"type":"string"},"exp":{"type":"string"},"sig":{"nullable":true}},"required":["src","uri","val","cts"]}}},"required":["id","name","handle"]}},"required":["id","createdAt","updatedAt","curator"]},"source":{"type":"object","properties":{"url":{"type":"string"},"metadata":{"type":"object","properties":{"url":{"type":"string"},"title":{"type":"string"},"description":{"type":"string"},"author":{"type":"string"},"publishedDate":{"type":"string"},"siteName":{"type":"string"},"imageUrl":{"type":"string"},"type":{"type":"string"},"retrievedAt":{"type":"string"},"doi":{"type":"string"},"isbn":{"type":"string"}},"required":["url"]},"urlLibraryCount":{"type":"number"},"urlInLibrary":{"type":"boolean"},"urlConnectionCount":{"type":"number"},"urlIsConnected":{"type":"boolean"}},"required":["url","metadata","urlLibraryCount"]},"target":{"type":"object","properties":{"url":{"type":"string"},"metadata":{"type":"object","properties":{"url":{"type":"string"},"title":{"type":"string"},"description":{"type":"string"},"author":{"type":"string"},"publishedDate":{"type":"string"},"siteName":{"type":"string"},"imageUrl":{"type":"string"},"type":{"type":"string"},"retrievedAt":{"type":"string"},"doi":{"type":"string"},"isbn":{"type":"string"}},"required":["url"]},"urlLibraryCount":{"type":"number"},"urlInLibrary":{"type":"boolean"},"urlConnectionCount":{"type":"number"},"urlIsConnected":{"type":"boolean"}},"required":["url","metadata","urlLibraryCount"]}},"required":["connection","source","target"]}},"pagination":{"type":"object","properties":{"currentPage":{"type":"number"},"totalPages":{"type":"number"},"totalCount":{"type":"number"},"hasMore":{"type":"boolean"},"limit":{"type":"number"}},"required":["currentPage","totalPages","totalCount","hasMore","limit"]},"sorting":{"type":"object","properties":{"sortBy":{"type":"string"},"sortOrder":{"type":"string","enum":["asc","desc"]}},"required":["sortBy","sortOrder"]}},"required":["connections","pagination","sorting"]}}}}}}}}}
```

## Create a connection

> Creates a typed link between two URLs or entities.

```json
{"openapi":"3.0.2","info":{"title":"Semble API","version":"1.0.0"},"servers":[{"url":"https://api.semble.so/xrpc"}],"paths":{"/network.cosmik.connection.create":{"post":{"description":"Creates a typed link between two URLs or entities.","summary":"Create a connection","tags":["connections"],"parameters":[],"operationId":"createConnection","requestBody":{"description":"Body","content":{"application/json":{"schema":{"type":"object","properties":{"sourceType":{"type":"string","enum":["URL","CARD"]},"sourceValue":{"type":"string"},"targetType":{"type":"string","enum":["URL","CARD"]},"targetValue":{"type":"string"},"connectionType":{"type":"string","enum":["SUPPORTS","OPPOSES","ADDRESSES","HELPFUL","LEADS_TO","RELATED","SUPPLEMENT","EXPLAINER"]},"note":{"type":"string"}},"required":["sourceType","sourceValue","targetType","targetValue"]}}}},"responses":{"200":{"description":"200","content":{"application/json":{"schema":{"type":"object","properties":{"connectionId":{"type":"string"}},"required":["connectionId"]}}}}}}}}}
```

## List a user's connections

> Returns a paginated list of connections created by a user, identified by handle or DID.

```json
{"openapi":"3.0.2","info":{"title":"Semble API","version":"1.0.0"},"servers":[{"url":"https://api.semble.so/xrpc"}],"paths":{"/network.cosmik.connection.listByUser":{"get":{"description":"Returns a paginated list of connections created by a user, identified by handle or DID.","summary":"List a user's connections","tags":["connections"],"parameters":[{"name":"page","in":"query","schema":{"type":"number","nullable":true}},{"name":"limit","in":"query","schema":{"type":"number","nullable":true}},{"name":"sortBy","in":"query","schema":{"type":"string"}},{"name":"sortOrder","in":"query","schema":{"type":"string","enum":["asc","desc"]}},{"name":"identifier","in":"query","required":true,"schema":{"type":"string"}},{"name":"connectionTypes","in":"query","schema":{"type":"array","items":{"type":"string","enum":["SUPPORTS","OPPOSES","ADDRESSES","HELPFUL","LEADS_TO","RELATED","SUPPLEMENT","EXPLAINER"]}}}],"operationId":"connectionsByUser","responses":{"200":{"description":"200","content":{"application/json":{"schema":{"type":"object","properties":{"connections":{"type":"array","items":{"type":"object","properties":{"connection":{"type":"object","properties":{"id":{"type":"string"},"type":{"type":"string"},"note":{"type":"string"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"curator":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"handle":{"type":"string"},"avatarUrl":{"type":"string"},"bannerUrl":{"type":"string"},"description":{"type":"string"},"isFollowing":{"type":"boolean"},"followsYou":{"type":"boolean"},"followerCount":{"type":"number"},"followingCount":{"type":"number"},"followedCollectionsCount":{"type":"number"},"urlCardCount":{"type":"number"},"collectionCount":{"type":"number"},"connectionCount":{"type":"number"},"connectionsByType":{"type":"object","properties":{"total":{"type":"number"}},"required":["total"],"additionalProperties":{"type":"number"}},"labels":{"type":"array","items":{"type":"object","properties":{"$type":{"type":"string","enum":["com.atproto.label.defs#label"]},"ver":{"type":"number"},"src":{"type":"string"},"uri":{"type":"string"},"cid":{"type":"string"},"val":{"type":"string"},"neg":{"type":"boolean"},"cts":{"type":"string"},"exp":{"type":"string"},"sig":{"nullable":true}},"required":["src","uri","val","cts"]}}},"required":["id","name","handle"]}},"required":["id","createdAt","updatedAt","curator"]},"source":{"type":"object","properties":{"url":{"type":"string"},"metadata":{"type":"object","properties":{"url":{"type":"string"},"title":{"type":"string"},"description":{"type":"string"},"author":{"type":"string"},"publishedDate":{"type":"string"},"siteName":{"type":"string"},"imageUrl":{"type":"string"},"type":{"type":"string"},"retrievedAt":{"type":"string"},"doi":{"type":"string"},"isbn":{"type":"string"}},"required":["url"]},"urlLibraryCount":{"type":"number"},"urlInLibrary":{"type":"boolean"},"urlConnectionCount":{"type":"number"},"urlIsConnected":{"type":"boolean"}},"required":["url","metadata","urlLibraryCount"]},"target":{"type":"object","properties":{"url":{"type":"string"},"metadata":{"type":"object","properties":{"url":{"type":"string"},"title":{"type":"string"},"description":{"type":"string"},"author":{"type":"string"},"publishedDate":{"type":"string"},"siteName":{"type":"string"},"imageUrl":{"type":"string"},"type":{"type":"string"},"retrievedAt":{"type":"string"},"doi":{"type":"string"},"isbn":{"type":"string"}},"required":["url"]},"urlLibraryCount":{"type":"number"},"urlInLibrary":{"type":"boolean"},"urlConnectionCount":{"type":"number"},"urlIsConnected":{"type":"boolean"}},"required":["url","metadata","urlLibraryCount"]}},"required":["connection","source","target"]}},"pagination":{"type":"object","properties":{"currentPage":{"type":"number"},"totalPages":{"type":"number"},"totalCount":{"type":"number"},"hasMore":{"type":"boolean"},"limit":{"type":"number"}},"required":["currentPage","totalPages","totalCount","hasMore","limit"]},"sorting":{"type":"object","properties":{"sortBy":{"type":"string"},"sortOrder":{"type":"string","enum":["asc","desc"]}},"required":["sortBy","sortOrder"]}},"required":["connections","pagination","sorting"]}}}}}}}}}
```

## Update a connection

> Updates the type or note on an existing connection.

```json
{"openapi":"3.0.2","info":{"title":"Semble API","version":"1.0.0"},"servers":[{"url":"https://api.semble.so/xrpc"}],"paths":{"/network.cosmik.connection.update":{"post":{"description":"Updates the type or note on an existing connection.","summary":"Update a connection","tags":["connections"],"parameters":[],"operationId":"updateConnection","requestBody":{"description":"Body","content":{"application/json":{"schema":{"type":"object","properties":{"connectionId":{"type":"string"},"connectionType":{"type":"string","enum":["SUPPORTS","OPPOSES","ADDRESSES","HELPFUL","LEADS_TO","RELATED","SUPPLEMENT","EXPLAINER"]},"note":{"type":"string"},"removeNote":{"type":"boolean"},"swap":{"type":"boolean"}},"required":["connectionId"]}}}},"responses":{"200":{"description":"200","content":{"application/json":{"schema":{"type":"object","properties":{"connectionId":{"type":"string"}},"required":["connectionId"]}}}}}}}}}
```

## Delete a connection

> Permanently deletes a connection owned by the authenticated user.

```json
{"openapi":"3.0.2","info":{"title":"Semble API","version":"1.0.0"},"servers":[{"url":"https://api.semble.so/xrpc"}],"paths":{"/network.cosmik.connection.delete":{"post":{"description":"Permanently deletes a connection owned by the authenticated user.","summary":"Delete a connection","tags":["connections"],"parameters":[],"operationId":"deleteConnection","requestBody":{"description":"Body","content":{"application/json":{"schema":{"type":"object","properties":{"connectionId":{"type":"string"}},"required":["connectionId"]}}}},"responses":{"200":{"description":"200","content":{"application/json":{"schema":{"type":"object","properties":{"connectionId":{"type":"string"}},"required":["connectionId"]}}}}}}}}}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.cosmik.network/semble-api/connections.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
