> ## Documentation Index
> Fetch the complete documentation index at: https://docs.wellapp.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Web Link

> A WebLink (table `core_api.web_links`) is an atomic contact-channel record that stores a URL together with its social/web platform classification

A WebLink (table `core_api.web_links`) is an atomic contact-channel record that stores a URL together with its social/web platform classification. WebLinks are shared, reusable objects attached to both Companies and People through the `company_web_links` and `person_web_links` bridge tables, following the same pivot-entity pattern as emails and phones. The entity holds a nullable `workspace` FK added in Migration20260119180000 to scope enrichment-created links. It is a Supporting root in the records layer, surfaced in composite `composite_web_links_list` columns on company and person pages.

| Naming                          | Value           |
| ------------------------------- | --------------- |
| Object                          | Web Link        |
| Resource type (JSON:API `type`) | `web_link`      |
| Collection / records root       | `web_links`     |
| REST base                       | `/v1/web-links` |
| Entity class                    | `WebLink`       |

## API operations

| Operation       | Method & path                              | Status        |
| --------------- | ------------------------------------------ | ------------- |
| List            | `GET /v1/web-links`                        | ✅ Implemented |
| List (nested)   | `GET /v1/people/{id}/web-links`            | ✅ Implemented |
| Retrieve        | `GET /v1/web-links/{id}`                   | ✅ Implemented |
| Create (nested) | `POST /v1/people/{id}/web-links`           | ✅ Implemented |
| Update          | `PATCH /v1/web-links/{id}`                 | 🟡 Planned    |
| Delete (nested) | `DELETE /v1/people/{id}/web-links/{subId}` | ✅ Implemented |

## Data model

### Attributes

| Field            | Type                                  | Required | Constraints                                                                                                                                                                                                                               | Allowed values                                                 | Description                                                                                                                        |
| ---------------- | ------------------------------------- | -------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------- |
| social\_link\_id | string, UUID, 🔒 system               | ✅ Yes    | unique; default gen\_random\_uuid()                                                                                                                                                                                                       | —                                                              | Public stable identifier for the web link, safe to expose in API responses. Generated by the database on insert.                   |
| platform         | string (PlatformEnum)                 | ✅ Yes    | native PostgreSQL enum core\_api.platform\_enum; original values twitter/linkedin/github created in Migration20250801141316; instagram/facebook/website/other added via ALTER TYPE ... ADD VALUE IF NOT EXISTS in Migration20260119180000 | twitter, linkedin, github, instagram, facebook, website, other | The social network or web platform the URL belongs to. Drives icon and renderer selection in the composite\_web\_links\_list cell. |
| url              | string                                | ✅ Yes    | varchar(255); NOT NULL; no uniqueness constraint (same URL may appear on multiple entities)                                                                                                                                               | —                                                              | The fully-qualified URL of the web presence (profile page, website, repository, etc.).                                             |
| created\_at      | string (ISO 8601 datetime), 🔒 system | ✅ Yes    | timestamptz; set by onCreate lifecycle hook; never null                                                                                                                                                                                   | —                                                              | Timestamp when the web link record was first persisted.                                                                            |
| updated\_at      | string (ISO 8601 datetime), 🔒 system | ⚪ No     | timestamptz; nullable; set by onCreate and onUpdate lifecycle hooks                                                                                                                                                                       | —                                                              | Timestamp of the last update. Null if the record has never been modified after creation.                                           |
| deleted\_at      | string (ISO 8601 datetime), 🔒 system | ⚪ No     | timestamptz; nullable                                                                                                                                                                                                                     | —                                                              | Soft-delete timestamp. When set, the web link is excluded from all active queries. Hard deletes do not occur on this entity.       |

### Relationships

| Name      | Type               | Required | Description                                                                                                                                                                                                       |
| --------- | ------------------ | -------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| workspace | to-one (workspace) | ⚪ No     | The workspace that owns this web link. Added in Migration20260119180000 to scope enrichment-created links; nullable because web links pre-dating that migration have no workspace assignment. ON DELETE SET NULL. |

### System-computed

* social\_link\_id is generated by gen\_random\_uuid() at the database level on INSERT; the application never supplies it.
* created\_at is set by the MikroORM onCreate lifecycle hook (new Date()); never written by application code.
* updated\_at is set by both onCreate and onUpdate lifecycle hooks; it may be null on records that have never been modified.
* deleted\_at is set to a non-null timestamp on soft delete; active queries must always filter deleted\_at: null. No hard-delete path exists on this entity.
* workspace\_pk (FK) was added as nullable in Migration20260119180000; records created before that migration have workspace = null. Enrichment pipelines may create web links with a workspace scope; connector-synced links may have workspace = null.
* PlatformEnum values instagram, facebook, website, and other were added to the native PostgreSQL enum in Migration20260119180000 via ALTER TYPE ... ADD VALUE IF NOT EXISTS. The original enum (twitter, linkedin, github) was created in Migration20250801141316.
* The web\_links table was created in Migration20250919154301, migrated from a legacy social\_links table. The social\_link\_id public UUID field preserves backward-compatible identity across that rename.

## Example

```json theme={null}
{
  "data": {
    "type": "web_link",
    "id": "a3f7c812-09be-4d2a-b5e1-dc4a78f30c92",
    "attributes": {
      "social_link_id": "a3f7c812-09be-4d2a-b5e1-dc4a78f30c92",
      "platform": "linkedin",
      "url": "https://www.linkedin.com/in/marie-leblanc-cfo",
      "created_at": "2025-11-14T09:22:05.000Z",
      "updated_at": "2025-11-14T09:22:05.000Z",
      "deleted_at": null
    },
    "relationships": {
      "workspace": {
        "data": { "type": "workspace", "id": "f1e2d3c4-b5a6-7890-abcd-ef1234567890" }
      }
    }
  }
}
```

<sub>Source: `apps/api/src/database/entities/WebLink.ts` · domain: financial-graph · tier: Supporting</sub>
