## Create a share link

`client.ShareLinks.New(ctx, body) (*ShareLinkNewResponse, error)`

**post** `/compute/v1/share-links`

Create an unauthenticated, read-only share link covering one or more predictions and/or pipelines that all live in the same workspace. The returned `id` is the bearer credential — treat it as a secret.

### Parameters

- `body ShareLinkNewParams`

  - `ExpiresAt param.Field[string]`

  - `AccessParameters param.Field[ShareLinkNewParamsAccessParametersUnion]`

    Access-control parameters for the share link. Discriminated by `access_mode`: `public` requires no other fields; `email` requires a non-empty `allowed_emails` list.

    - `type ShareLinkNewParamsAccessParametersPublicShareLinkAccessParameters struct{…}`

      Public access: anyone holding the share link ID can read.

      - `AccessMode Public`

        - `const PublicPublic Public = "public"`

    - `type ShareLinkNewParamsAccessParametersEmailShareLinkAccessParameters struct{…}`

      Email-restricted access: only the addresses in `allowed_emails` can read the link.

      - `AccessMode Email`

        - `const EmailEmail Email = "email"`

      - `AllowedEmails []string`

        Email addresses allowed to read the link. Must contain at least one address; up to 100 entries.

  - `PipelineIDs param.Field[[]string]`

    Pipelines to expose through the share link. Must belong to the resolved workspace. Up to 100 entries.

  - `PredictionIDs param.Field[[]string]`

    Predictions to expose through the share link. Must belong to the resolved workspace. Up to 100 entries.

  - `WorkspaceID param.Field[string]`

    Workspace ID. Only used with admin API keys. Ignored (or validated) for workspace-scoped keys.

### Returns

- `type ShareLinkNewResponse struct{…}`

  - `ID string`

    Share link ID. This value is the bearer credential used to access the linked resources — treat it as a secret.

  - `AccessParameters ShareLinkNewResponseAccessParametersUnion`

    Access-control parameters for the share link. Discriminated by `access_mode`: `public` requires no other fields; `email` requires a non-empty `allowed_emails` list.

    - `type ShareLinkNewResponseAccessParametersPublicShareLinkAccessParameters struct{…}`

      Public access: anyone holding the share link ID can read.

      - `AccessMode Public`

        - `const PublicPublic Public = "public"`

    - `type ShareLinkNewResponseAccessParametersEmailShareLinkAccessParameters struct{…}`

      Email-restricted access: only the addresses in `allowed_emails` can read the link.

      - `AccessMode Email`

        - `const EmailEmail Email = "email"`

      - `AllowedEmails []string`

        Email addresses allowed to read the link. Must contain at least one address; up to 100 entries.

  - `ArchivedAt Time`

    When the share link was archived, or null if it has never been archived.

  - `CreatedAt Time`

    When the share link was created.

  - `ExpiresAt Time`

    When the share link stops granting access.

  - `PipelineIDs []string`

    Pipelines exposed by this share link.

  - `PredictionIDs []string`

    Predictions exposed by this share link.

  - `WorkspaceID string`

    Workspace that owns the share link and the referenced resources.

  - `URL string`

    Visitable share link URL for the deployment's public app. Present when the deployment has a configured app host; otherwise construct as `<your-app-host>/share/{id}`. Treat as a secret — the `{id}` segment is the bearer credential.

### Example

```go
package main

import (
  "context"
  "fmt"

  "github.com/boltz-bio/boltz-api-go"
  "github.com/boltz-bio/boltz-api-go/option"
)

func main() {
  client := boltzapi.NewClient(
    option.WithAPIKey("My API Key"),
  )
  shareLink, err := client.ShareLinks.New(context.TODO(), boltzapi.ShareLinkNewParams{
    ExpiresAt: "expires_at",
  })
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", shareLink.ID)
}
```

#### Response

```json
{
  "id": "shr_qoEFr2BlPTBLuM5BinaC8x7iVPP_AwppEOmlxQjJ-eo",
  "access_parameters": {
    "access_mode": "public"
  },
  "archived_at": "2019-12-27T18:11:19.117Z",
  "created_at": "2019-12-27T18:11:19.117Z",
  "expires_at": "2019-12-27T18:11:19.117Z",
  "pipeline_ids": [
    "string"
  ],
  "prediction_ids": [
    "string"
  ],
  "workspace_id": "workspace_id",
  "url": "https://lab.boltz.bio/share/shr_qoEFr2BlPTBLuM5BinaC8x7iVPP_AwppEOmlxQjJ-eo"
}
```
