# 書き込み

> ワークスペースに書き込む。12 個のツールを、パラメーターと呼び出し例とともに掲載しています。

Source: https://piqline.com/ja/docs/api/reference/write

ワークスペースのオブジェクトを作成または変更する、Piqline エージェントのツールです。`write` スコープが必要です。

各呼び出しは `POST` リクエストで、キーは `Authorization: Bearer` に入れます。JSON の本文がツールの入力で、レスポンスは `{ "tool": "nom", "output": … }` の形式です。例には必須パラメーターだけを入れています。パラメーターの説明は、エージェントが読むものと同じです。

### `updateWorkspaceProfile`

ワークスペースのニーズプロファイルを保存します。目的、テーマ、エンティティ、言語、地域、レベル、ペース。

`POST https://piqline.com/api/v1/tools/updateWorkspaceProfile`

種類: 書き込み。スコープ: `write`。

| パラメーター | 型 | 必須 | 説明 |
| --- | --- | --- | --- |
| `needs` | `object` | いいえ |  |
| `stage` | `string` | いいえ |  |
| `onboarding_status` | `not_started \| in_progress \| done \| skipped` | いいえ |  |
| `summary` | `string` | いいえ |  |

```bash tab="curl"
curl -s https://piqline.com/api/v1/tools/updateWorkspaceProfile \
  -H "Authorization: Bearer $PIQLINE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{}'
```
```javascript tab="JavaScript"
const response = await fetch("https://piqline.com/api/v1/tools/updateWorkspaceProfile", {
  method: "POST",
  headers: {
    Authorization: "Bearer " + process.env.PIQLINE_API_KEY,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({}),
});
const { output } = await response.json();
```
```python tab="Python"
import os
import requests

response = requests.post(
    "https://piqline.com/api/v1/tools/updateWorkspaceProfile",
    headers={"Authorization": "Bearer " + os.environ["PIQLINE_API_KEY"]},
    json={},
)
output = response.json()["output"]
```

### `followEntity`

企業、ブランド、公開アカウント（個人は対象外）を追跡し、そのアイテムと言及を関連付けます。

`POST https://piqline.com/api/v1/tools/followEntity`

種類: 書き込み。スコープ: `write`。

| パラメーター | 型 | 必須 | 説明 |
| --- | --- | --- | --- |
| `name` | `string` | はい |  |
| `kind` | `company \| brand \| account` | いいえ |  |
| `siren` | `string` | いいえ |  |
| `domain` | `string` | いいえ |  |
| `handles` | `array<object>` | いいえ |  |
| `role` | `self \| competitor \| client \| target \| other` | いいえ |  |
| `aliases` | `array<string>` | いいえ |  |

```bash tab="curl"
curl -s https://piqline.com/api/v1/tools/followEntity \
  -H "Authorization: Bearer $PIQLINE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"name":"texte"}'
```
```javascript tab="JavaScript"
const response = await fetch("https://piqline.com/api/v1/tools/followEntity", {
  method: "POST",
  headers: {
    Authorization: "Bearer " + process.env.PIQLINE_API_KEY,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    "name": "texte"
  }),
});
const { output } = await response.json();
```
```python tab="Python"
import os
import requests

response = requests.post(
    "https://piqline.com/api/v1/tools/followEntity",
    headers={"Authorization": "Bearer " + os.environ["PIQLINE_API_KEY"]},
    json={
        "name": "texte",
    },
)
output = response.json()["output"]
```

### `unfollowEntity`

エンティティの追跡を止めます。既存の関連付けは残ります。

`POST https://piqline.com/api/v1/tools/unfollowEntity`

種類: 削除。スコープ: `write`。

| パラメーター | 型 | 必須 | 説明 |
| --- | --- | --- | --- |
| `entityId` | `string` | はい |  |

```bash tab="curl"
curl -s https://piqline.com/api/v1/tools/unfollowEntity \
  -H "Authorization: Bearer $PIQLINE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"entityId":"5a0e9c1f-2b7d-4e63-8f14-d3c8a6b92e70"}'
```
```javascript tab="JavaScript"
const response = await fetch("https://piqline.com/api/v1/tools/unfollowEntity", {
  method: "POST",
  headers: {
    Authorization: "Bearer " + process.env.PIQLINE_API_KEY,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    "entityId": "5a0e9c1f-2b7d-4e63-8f14-d3c8a6b92e70"
  }),
});
const { output } = await response.json();
```
```python tab="Python"
import os
import requests

response = requests.post(
    "https://piqline.com/api/v1/tools/unfollowEntity",
    headers={"Authorization": "Bearer " + os.environ["PIQLINE_API_KEY"]},
    json={
        "entityId": "5a0e9c1f-2b7d-4e63-8f14-d3c8a6b92e70",
    },
)
output = response.json()["output"]
```

### `saveBookmark`

ワークスペースのヴォールトにブックマークを保存します。http(s) の URL は、読み取り、アーカイブ、ベクトル化のキューに入ります。

`POST https://piqline.com/api/v1/tools/saveBookmark`

種類: 書き込み。スコープ: `write`。

| パラメーター | 型 | 必須 | 説明 |
| --- | --- | --- | --- |
| `title` | `string` | はい |  |
| `href` | `string` | はい |  |
| `kind` | `item \| source \| signal \| graph \| search \| document \| board \| chat` | いいえ |  |
| `subtitle` | `string` | いいえ |  |
| `note` | `string` | いいえ |  |
| `tags` | `array<string>` | いいえ |  |
| `origin` | `dashboard \| api \| slack \| whatsapp \| mail \| other` | いいえ |  |
| `originRef` | `string` | いいえ |  |

```bash tab="curl"
curl -s https://piqline.com/api/v1/tools/saveBookmark \
  -H "Authorization: Bearer $PIQLINE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"title":"texte","href":"texte"}'
```
```javascript tab="JavaScript"
const response = await fetch("https://piqline.com/api/v1/tools/saveBookmark", {
  method: "POST",
  headers: {
    Authorization: "Bearer " + process.env.PIQLINE_API_KEY,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    "title": "texte",
    "href": "texte"
  }),
});
const { output } = await response.json();
```
```python tab="Python"
import os
import requests

response = requests.post(
    "https://piqline.com/api/v1/tools/saveBookmark",
    headers={"Authorization": "Bearer " + os.environ["PIQLINE_API_KEY"]},
    json={
        "title": "texte",
        "href": "texte",
    },
)
output = response.json()["output"]
```

### `setWatchContract`

ソースにウォッチ契約を設定します。以後、ウォッチのページには条件に合うアイテムだけが表示されます。決定的な処理で、モデルは使いません。

`POST https://piqline.com/api/v1/tools/setWatchContract`

種類: 書き込み。スコープ: `write`。

| パラメーター | 型 | 必須 | 説明 |
| --- | --- | --- | --- |
| `sourceId` | `string` | はい |  |
| `intent` | `string` | はい | What this workspace watches on the source, in the person's words. |
| `include` | `array<string>` | いいえ | Keep an item only if it contains at least one of these terms (whole word, any case or accent). |
| `exclude` | `array<string>` | いいえ | Drop an item containing any of these terms. |
| `event` | `hiring \| funding \| launch \| expansion \| reorg \| open_to_work \| leaving \| interested_comment \| …` | いいえ | Business event the item must announce (hiring, funding, launch…), read from its text. |
| `sectors` | `array<string>` | いいえ |  |

```bash tab="curl"
curl -s https://piqline.com/api/v1/tools/setWatchContract \
  -H "Authorization: Bearer $PIQLINE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"sourceId":"5a0e9c1f-2b7d-4e63-8f14-d3c8a6b92e70","intent":"texte"}'
```
```javascript tab="JavaScript"
const response = await fetch("https://piqline.com/api/v1/tools/setWatchContract", {
  method: "POST",
  headers: {
    Authorization: "Bearer " + process.env.PIQLINE_API_KEY,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    "sourceId": "5a0e9c1f-2b7d-4e63-8f14-d3c8a6b92e70",
    "intent": "texte"
  }),
});
const { output } = await response.json();
```
```python tab="Python"
import os
import requests

response = requests.post(
    "https://piqline.com/api/v1/tools/setWatchContract",
    headers={"Authorization": "Bearer " + os.environ["PIQLINE_API_KEY"]},
    json={
        "sourceId": "5a0e9c1f-2b7d-4e63-8f14-d3c8a6b92e70",
        "intent": "texte",
    },
)
output = response.json()["output"]
```

### `removeWatchContract`

ソースのウォッチ契約を削除します。すべてのアイテムが再び表示されます。

`POST https://piqline.com/api/v1/tools/removeWatchContract`

種類: 削除。スコープ: `write`。

| パラメーター | 型 | 必須 | 説明 |
| --- | --- | --- | --- |
| `sourceId` | `string` | はい |  |

```bash tab="curl"
curl -s https://piqline.com/api/v1/tools/removeWatchContract \
  -H "Authorization: Bearer $PIQLINE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"sourceId":"5a0e9c1f-2b7d-4e63-8f14-d3c8a6b92e70"}'
```
```javascript tab="JavaScript"
const response = await fetch("https://piqline.com/api/v1/tools/removeWatchContract", {
  method: "POST",
  headers: {
    Authorization: "Bearer " + process.env.PIQLINE_API_KEY,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    "sourceId": "5a0e9c1f-2b7d-4e63-8f14-d3c8a6b92e70"
  }),
});
const { output } = await response.json();
```
```python tab="Python"
import os
import requests

response = requests.post(
    "https://piqline.com/api/v1/tools/removeWatchContract",
    headers={"Authorization": "Bearer " + os.environ["PIQLINE_API_KEY"]},
    json={
        "sourceId": "5a0e9c1f-2b7d-4e63-8f14-d3c8a6b92e70",
    },
)
output = response.json()["output"]
```

### `initReaderInterview`

読み方のインタビューの 2 つの回答（要点か詳細か、主な意図）を、閲覧プロファイルに保存します。

`POST https://piqline.com/api/v1/tools/initReaderInterview`

種類: 書き込み。スコープ: `write`。

| パラメーター | 型 | 必須 | 説明 |
| --- | --- | --- | --- |
| `density` | `essentiel \| detail` | はい |  |
| `intent` | `read-arrivals \| spot-change \| watch-entities \| compare \| measure-coverage \| control-sources \| analyze-market \| prepare-output \| …` | はい |  |

```bash tab="curl"
curl -s https://piqline.com/api/v1/tools/initReaderInterview \
  -H "Authorization: Bearer $PIQLINE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"density":"essentiel","intent":"read-arrivals"}'
```
```javascript tab="JavaScript"
const response = await fetch("https://piqline.com/api/v1/tools/initReaderInterview", {
  method: "POST",
  headers: {
    Authorization: "Bearer " + process.env.PIQLINE_API_KEY,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    "density": "essentiel",
    "intent": "read-arrivals"
  }),
});
const { output } = await response.json();
```
```python tab="Python"
import os
import requests

response = requests.post(
    "https://piqline.com/api/v1/tools/initReaderInterview",
    headers={"Authorization": "Bearer " + os.environ["PIQLINE_API_KEY"]},
    json={
        "density": "essentiel",
        "intent": "read-arrivals",
    },
)
output = response.json()["output"]
```

### `applyBoardChange`

すでに承認された変更を、ボードに適用します。

`POST https://piqline.com/api/v1/tools/applyBoardChange`

種類: 書き込み。スコープ: `write`。

| パラメーター | 型 | 必須 | 説明 |
| --- | --- | --- | --- |
| `dashboardId` | `string` | いいえ |  |
| `changes` | `array<object>` | はい |  |

```bash tab="curl"
curl -s https://piqline.com/api/v1/tools/applyBoardChange \
  -H "Authorization: Bearer $PIQLINE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"changes":[{"id":"5a0e9c1f-2b7d-4e63-8f14-d3c8a6b92e70","kind":"add","widgetId":"5a0e9c1f-2b7d-4e63-8f14-d3c8a6b92e70","reason":"texte","title":"texte"}]}'
```
```javascript tab="JavaScript"
const response = await fetch("https://piqline.com/api/v1/tools/applyBoardChange", {
  method: "POST",
  headers: {
    Authorization: "Bearer " + process.env.PIQLINE_API_KEY,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    "changes": [
      {
        "id": "5a0e9c1f-2b7d-4e63-8f14-d3c8a6b92e70",
        "kind": "add",
        "widgetId": "5a0e9c1f-2b7d-4e63-8f14-d3c8a6b92e70",
        "reason": "texte",
        "title": "texte"
      }
    ]
  }),
});
const { output } = await response.json();
```
```python tab="Python"
import os
import requests

response = requests.post(
    "https://piqline.com/api/v1/tools/applyBoardChange",
    headers={"Authorization": "Bearer " + os.environ["PIQLINE_API_KEY"]},
    json={
        "changes": [
            {
                "id": "5a0e9c1f-2b7d-4e63-8f14-d3c8a6b92e70",
                "kind": "add",
                "widgetId": "5a0e9c1f-2b7d-4e63-8f14-d3c8a6b92e70",
                "reason": "texte",
                "title": "texte",
            },
        ],
    },
)
output = response.json()["output"]
```

### `buildDashboard`

ウィジェットの選択画面を経由せず、ボードを直接作成します。

`POST https://piqline.com/api/v1/tools/buildDashboard`

種類: 書き込み。スコープ: `write`。

| パラメーター | 型 | 必須 | 説明 |
| --- | --- | --- | --- |
| `spec` | `object` | はい |  |
| `save` | `boolean` | いいえ | Persist the board when the user is owner/admin. |

```bash tab="curl"
curl -s https://piqline.com/api/v1/tools/buildDashboard \
  -H "Authorization: Bearer $PIQLINE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"spec":{"version":1,"title":"texte","description":"texte","period":"1h","widgets":[{"kind":"texte","title":"texte"}]}}'
```
```javascript tab="JavaScript"
const response = await fetch("https://piqline.com/api/v1/tools/buildDashboard", {
  method: "POST",
  headers: {
    Authorization: "Bearer " + process.env.PIQLINE_API_KEY,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    "spec": {
      "version": 1,
      "title": "texte",
      "description": "texte",
      "period": "1h",
      "widgets": [
        {
          "kind": "texte",
          "title": "texte"
        }
      ]
    }
  }),
});
const { output } = await response.json();
```
```python tab="Python"
import os
import requests

response = requests.post(
    "https://piqline.com/api/v1/tools/buildDashboard",
    headers={"Authorization": "Bearer " + os.environ["PIQLINE_API_KEY"]},
    json={
        "spec": {
            "version": 1,
            "title": "texte",
            "description": "texte",
            "period": "1h",
            "widgets": [
                {
                    "kind": "texte",
                    "title": "texte",
                },
            ],
        },
    },
)
output = response.json()["output"]
```

### `saveWorkspaceTable`

ワークスペースのテーブルを、必要な列を入れた状態で作成します。

`POST https://piqline.com/api/v1/tools/saveWorkspaceTable`

種類: 書き込み。スコープ: `write`。

| パラメーター | 型 | 必須 | 説明 |
| --- | --- | --- | --- |
| `name` | `string` | はい |  |
| `comment` | `string` | はい |  |
| `columns` | `array<object>` | はい |  |
| `rows` | `array<object>` | はい |  |

```bash tab="curl"
curl -s https://piqline.com/api/v1/tools/saveWorkspaceTable \
  -H "Authorization: Bearer $PIQLINE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"name":"texte","comment":"texte","columns":[{"id":"5a0e9c1f-2b7d-4e63-8f14-d3c8a6b92e70","name":"texte","type":"text"}],"rows":[{}]}'
```
```javascript tab="JavaScript"
const response = await fetch("https://piqline.com/api/v1/tools/saveWorkspaceTable", {
  method: "POST",
  headers: {
    Authorization: "Bearer " + process.env.PIQLINE_API_KEY,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    "name": "texte",
    "comment": "texte",
    "columns": [
      {
        "id": "5a0e9c1f-2b7d-4e63-8f14-d3c8a6b92e70",
        "name": "texte",
        "type": "text"
      }
    ],
    "rows": [
      {}
    ]
  }),
});
const { output } = await response.json();
```
```python tab="Python"
import os
import requests

response = requests.post(
    "https://piqline.com/api/v1/tools/saveWorkspaceTable",
    headers={"Authorization": "Bearer " + os.environ["PIQLINE_API_KEY"]},
    json={
        "name": "texte",
        "comment": "texte",
        "columns": [
            {
                "id": "5a0e9c1f-2b7d-4e63-8f14-d3c8a6b92e70",
                "name": "texte",
                "type": "text",
            },
        ],
        "rows": [
            {},
        ],
    },
)
output = response.json()["output"]
```

### `writeFromWatch`

ワークスペースのウォッチにあるアイテムから文章を作成します（記事、LinkedIn 投稿、X のスレッド、Instagram のキャプション、ニュースレター、動画の台本、プレスリリース、SEO 記事、メール、要約）。9 言語に対応し、すべての事実に出典を [n] で付けます。文章は下書きに追加されます。少量のクレジットを使います。

`POST https://piqline.com/api/v1/tools/writeFromWatch`

種類: 書き込み。スコープ: `write`。

| パラメーター | 型 | 必須 | 説明 |
| --- | --- | --- | --- |
| `instruction` | `string` | はい | What to write and for whom, in plain words, e.g. « Le post de la semaine sur ce qui a bougé dans la cosmétique ». |
| `example` | `string` | いいえ | Optional sample text whose style to follow. |
| `scope` | `object` | いいえ | Which items of the workspace watches to write from: sources, topics, keywords, platforms, item types or item ids, period and depth. Default: the last 7 days, 15 items. |
| `pen` | `object` | いいえ | Format (article, linkedin, x_thread, instagram, newsletter, video_script, press_release, seo_brief, email, summary), goal, tone, framework, length, voice, language (fr, en, es, de, it, pt, nl, he, ar), creativity, variants and options. |
| `save` | `boolean` | いいえ | Keep the text in the workspace drafts (default). false: return it only. |

```bash tab="curl"
curl -s https://piqline.com/api/v1/tools/writeFromWatch \
  -H "Authorization: Bearer $PIQLINE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"instruction":"texte"}'
```
```javascript tab="JavaScript"
const response = await fetch("https://piqline.com/api/v1/tools/writeFromWatch", {
  method: "POST",
  headers: {
    Authorization: "Bearer " + process.env.PIQLINE_API_KEY,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    "instruction": "texte"
  }),
});
const { output } = await response.json();
```
```python tab="Python"
import os
import requests

response = requests.post(
    "https://piqline.com/api/v1/tools/writeFromWatch",
    headers={"Authorization": "Bearer " + os.environ["PIQLINE_API_KEY"]},
    json={
        "instruction": "texte",
    },
)
output = response.json()["output"]
```

### `setTableFeed`

テーブルを自動で更新するようにします。ルールに合うコーパスのアイテムがあれば、確認の後で追加されます。status=paused で追加を止めます。

`POST https://piqline.com/api/v1/tools/setTableFeed`

種類: アクション。スコープ: `act`, `write`。

| パラメーター | 型 | 必須 | 説明 |
| --- | --- | --- | --- |
| `schema` | `string` | いいえ |  |
| `name` | `string` | はい |  |
| `status` | `live \| paused` | いいえ |  |
| `prompt` | `string` | はい | The person's words, unchanged. |
| `summary` | `string` | はい | What you understood, in plain French, one sentence. |
| `sourceIds` | `array<string>` | いいえ |  |
| `sourceLabels` | `array<string>` | いいえ |  |
| `query` | `string` | いいえ |  |
| `platform` | `string` | いいえ |  |
| `itemType` | `post \| video \| article \| listing \| job_offer` | いいえ |  |
| `alreadyMatching` | `integer` | いいえ | How many items searchItems found just now. |

```bash tab="curl"
curl -s https://piqline.com/api/v1/tools/setTableFeed \
  -H "Authorization: Bearer $PIQLINE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"name":"texte","prompt":"texte","summary":"texte"}'
```
```javascript tab="JavaScript"
const response = await fetch("https://piqline.com/api/v1/tools/setTableFeed", {
  method: "POST",
  headers: {
    Authorization: "Bearer " + process.env.PIQLINE_API_KEY,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    "name": "texte",
    "prompt": "texte",
    "summary": "texte"
  }),
});
const { output } = await response.json();
```
```python tab="Python"
import os
import requests

response = requests.post(
    "https://piqline.com/api/v1/tools/setTableFeed",
    headers={"Authorization": "Bearer " + os.environ["PIQLINE_API_KEY"]},
    json={
        "name": "texte",
        "prompt": "texte",
        "summary": "texte",
    },
)
output = response.json()["output"]
```
