> For the complete documentation index, see [llms.txt](https://docs.cosmik.network/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.cosmik.network/semble-api/connections.md).

# 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","enum":["createdAt","updatedAt"]}},{"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"},"isSubscribed":{"type":"boolean"},"subscriptionScopes":{"type":"array","items":{"type":"string","enum":["CARD","CONNECTION","COLLECTION_SAVED"]}},"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","enum":["createdAt","updatedAt"]},"sortOrder":{"type":"string","enum":["asc","desc"]}},"required":["sortBy","sortOrder"]}},"required":["connections","pagination","sorting"]}}}}}}}}}
```

## Create a connection

> Creates a typed link between two URLs with an optional note.

```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 with an optional note.","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. Filterable by connection 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.listByUser":{"get":{"description":"Returns a paginated list of connections created by a user, identified by handle or DID. Filterable by connection type.","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","enum":["createdAt","updatedAt"]}},{"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"},"isSubscribed":{"type":"boolean"},"subscriptionScopes":{"type":"array","items":{"type":"string","enum":["CARD","CONNECTION","COLLECTION_SAVED"]}},"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","enum":["createdAt","updatedAt"]},"sortOrder":{"type":"string","enum":["asc","desc"]}},"required":["sortBy","sortOrder"]}},"required":["connections","pagination","sorting"]}}}}}}}}}
```

## Update a connection

> Updates the type, note, or direction of 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, note, or direction of 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
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

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

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
