# Corpus

> Lire le corpus et le workspace. 22 outils, avec leurs paramètres et des exemples d’appel.

Source: https://piqline.com/fr/docs/api/reference/corpus

Outils de l’agent Piqline. Ils lisent ce que le workspace a déjà collecté : aucun crédit consommé, aucune écriture.

Chaque appel est une requête `POST` avec la clé en `Authorization: Bearer`. Le corps JSON est l’entrée de l’outil, et la réponse a la forme `{ "tool": "nom", "output": … }`. Les exemples ne portent que les paramètres requis. Les descriptions des paramètres sont celles que lisent les agents, en anglais.

### `getCoverageStats`

Volumes et santé de la collecte : totaux, répartition par plateforme et par nature, série d’ingestion sur la fenêtre d’analyse (`1h`, `24h`, `7d` ou `30d`).

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

Type : Lecture. Scopes : `read`.

| Paramètre | Type | Requis | Description |
| --- | --- | --- | --- |
| `period` | `1h \| 24h \| 7d \| 30d` | Non | Analysis window |

```bash tab="curl"
curl -s https://piqline.com/api/v1/tools/getCoverageStats \
  -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/getCoverageStats", {
  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/getCoverageStats",
    headers={"Authorization": "Bearer " + os.environ["PIQLINE_API_KEY"]},
    json={},
)
output = response.json()["output"]
```

### `listSources`

Sources suivies par le workspace, avec le nombre d’items, l’état de santé et la dernière lecture.

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

Type : Lecture. Scopes : `read`.

Cet outil n’attend aucun paramètre : envoyez un corps vide, `{}`.

```bash tab="curl"
curl -s https://piqline.com/api/v1/tools/listSources \
  -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/listSources", {
  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/listSources",
    headers={"Authorization": "Bearer " + os.environ["PIQLINE_API_KEY"]},
    json={},
)
output = response.json()["output"]
```

### `searchItems`

Recherche d’items (posts, vidéos, articles, annonces, offres) avec filtres : texte, plateforme, nature, source. Sans filtre, renvoie les plus récents (40 au plus).

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

Type : Lecture. Scopes : `read`.

| Paramètre | Type | Requis | Description |
| --- | --- | --- | --- |
| `query` | `string` | Non | Free-text match on title and body |
| `platform` | `string` | Non |  |
| `itemType` | `post \| video \| article \| listing \| job_offer` | Non |  |
| `sourceId` | `string` | Non |  |
| `limit` | `integer` | Non |  |

```bash tab="curl"
curl -s https://piqline.com/api/v1/tools/searchItems \
  -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/searchItems", {
  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/searchItems",
    headers={"Authorization": "Bearer " + os.environ["PIQLINE_API_KEY"]},
    json={},
)
output = response.json()["output"]
```

### `getItem`

Détail d’un item : texte, transcription, OCR, thèmes détectés, items proches par le sens, et ses dates d’observation.

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

Type : Lecture. Scopes : `read`.

| Paramètre | Type | Requis | Description |
| --- | --- | --- | --- |
| `itemId` | `string` | Oui |  |

```bash tab="curl"
curl -s https://piqline.com/api/v1/tools/getItem \
  -H "Authorization: Bearer $PIQLINE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"itemId":"5a0e9c1f-2b7d-4e63-8f14-d3c8a6b92e70"}'
```
```javascript tab="JavaScript"
const response = await fetch("https://piqline.com/api/v1/tools/getItem", {
  method: "POST",
  headers: {
    Authorization: "Bearer " + process.env.PIQLINE_API_KEY,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    "itemId": "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/getItem",
    headers={"Authorization": "Bearer " + os.environ["PIQLINE_API_KEY"]},
    json={
        "itemId": "5a0e9c1f-2b7d-4e63-8f14-d3c8a6b92e70",
    },
)
output = response.json()["output"]
```

### `searchPassages`

Recherche par le sens dans les documents longs (PDF lus par le Motor) : passages les plus proches d’une question, avec l’item, la page et le titre de section.

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

Type : Lecture. Scopes : `read`.

| Paramètre | Type | Requis | Description |
| --- | --- | --- | --- |
| `query` | `string` | Oui | Question or phrase to look for |
| `itemId` | `string` | Non | Limit to one document |
| `limit` | `integer` | Non |  |

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

response = requests.post(
    "https://piqline.com/api/v1/tools/searchPassages",
    headers={"Authorization": "Bearer " + os.environ["PIQLINE_API_KEY"]},
    json={
        "query": "levée de fonds",
    },
)
output = response.json()["output"]
```

### `citeItem`

Vérifie qu’un passage est écrit mot pour mot dans un item et rend un numéro de citation ; sinon le passage le plus proche. Base du mode « Citations » du chat.

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

Type : Lecture. Scopes : `read`.

| Paramètre | Type | Requis | Description |
| --- | --- | --- | --- |
| `itemId` | `string` | Oui | Item id from searchItems or getItem |
| `quote` | `string` | Oui | Exact passage copied from the item text |

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

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

### `drawDiagram`

Dessine la réponse en un schéma SVG (frise, matrice, flux, arbre…) : couleurs par rôle du thème, SVG nettoyé avant affichage. Base du mode « Diagramme » du chat.

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

Type : Lecture. Scopes : `read`.

| Paramètre | Type | Requis | Description |
| --- | --- | --- | --- |
| `type` | `architecture \| flowchart \| sequence \| state \| timeline \| swimlane \| quadrant \| tree \| …` | Oui | Visual type chosen for the layout |
| `title` | `string` | Oui | Short name of the subject, in the user's language |
| `description` | `string` | Oui | One sentence on what the diagram shows, for screen readers and the caption |
| `svg` | `string` | Oui | A single <svg viewBox="0 0 960 H">…</svg> following the diagram rules |

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

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

### `createCanvas`

Compile un canvas (fichier TSX qui n’importe que le SDK piqline/canvas) et rend le code prêt à afficher, ou l’erreur à corriger. Base des modes Canvas et Rapport du chat.

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

Type : Lecture. Scopes : `read`.

| Paramètre | Type | Requis | Description |
| --- | --- | --- | --- |
| `title` | `string` | Oui | Short title shown above the canvas, in French |
| `source` | `string` | Oui | Full .canvas.tsx source |

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

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

### `getTopics`

Thèmes détectés avec leur part de voix, et récits (le même sujet vu sur plusieurs sources).

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

Type : Lecture. Scopes : `read`.

| Paramètre | Type | Requis | Description |
| --- | --- | --- | --- |
| `period` | `1h \| 24h \| 7d \| 30d` | Non | Analysis window |

```bash tab="curl"
curl -s https://piqline.com/api/v1/tools/getTopics \
  -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/getTopics", {
  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/getTopics",
    headers={"Authorization": "Bearer " + os.environ["PIQLINE_API_KEY"]},
    json={},
)
output = response.json()["output"]
```

### `getSignals`

Signaux ouverts, déclenchés par les règles de persistance du workspace, avec leur avance et leur statut.

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

Type : Lecture. Scopes : `read`.

Cet outil n’attend aucun paramètre : envoyez un corps vide, `{}`.

```bash tab="curl"
curl -s https://piqline.com/api/v1/tools/getSignals \
  -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/getSignals", {
  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/getSignals",
    headers={"Authorization": "Bearer " + os.environ["PIQLINE_API_KEY"]},
    json={},
)
output = response.json()["output"]
```

### `listWorkspaceTables`

Tables déjà créées dans le workspace : nom, commentaire, nombre de colonnes et de lignes, et si la table se remplit toute seule.

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

Type : Lecture. Scopes : `read`.

Cet outil n’attend aucun paramètre : envoyez un corps vide, `{}`.

```bash tab="curl"
curl -s https://piqline.com/api/v1/tools/listWorkspaceTables \
  -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/listWorkspaceTables", {
  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/listWorkspaceTables",
    headers={"Authorization": "Bearer " + os.environ["PIQLINE_API_KEY"]},
    json={},
)
output = response.json()["output"]
```

### `getWorkspaceTable`

Une table du workspace en JSON : schéma, colonnes et lignes. Sert de base ou de feed pour un site, une appli ou un agent (scope read).

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

Type : Lecture. Scopes : `read`.

| Paramètre | Type | Requis | Description |
| --- | --- | --- | --- |
| `schema` | `string` | Non | Schema, default public. |
| `name` | `string` | Oui | Table name. |

```bash tab="curl"
curl -s https://piqline.com/api/v1/tools/getWorkspaceTable \
  -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/getWorkspaceTable", {
  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/getWorkspaceTable",
    headers={"Authorization": "Bearer " + os.environ["PIQLINE_API_KEY"]},
    json={
        "name": "texte",
    },
)
output = response.json()["output"]
```

### `listBookmarks`

Signets et dossiers du coffre du workspace : titre, type, dossier, statut, admission. Filtre optionnel par mot, statut ou type.

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

Type : Lecture. Scopes : `read`.

| Paramètre | Type | Requis | Description |
| --- | --- | --- | --- |
| `query` | `string` | Non | Optional filter on title, note or tags. |
| `status` | `inbox \| reading \| done` | Non |  |
| `kind` | `item \| source \| signal \| graph \| search \| document \| board \| chat` | Non |  |

```bash tab="curl"
curl -s https://piqline.com/api/v1/tools/listBookmarks \
  -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/listBookmarks", {
  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/listBookmarks",
    headers={"Authorization": "Bearer " + os.environ["PIQLINE_API_KEY"]},
    json={},
)
output = response.json()["output"]
```

### `listEntities`

Entités suivies (entreprises, marques, comptes publics) et items liés sur la période.

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

Type : Lecture. Scopes : `read`.

| Paramètre | Type | Requis | Description |
| --- | --- | --- | --- |
| `period` | `7d \| 30d \| 90d` | Non |  |

```bash tab="curl"
curl -s https://piqline.com/api/v1/tools/listEntities \
  -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/listEntities", {
  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/listEntities",
    headers={"Authorization": "Bearer " + os.environ["PIQLINE_API_KEY"]},
    json={},
)
output = response.json()["output"]
```

### `listWatchContracts`

Contrats de veille posés sur les sources : intention, termes gardés et exclus, événement.

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

Type : Lecture. Scopes : `read`.

Cet outil n’attend aucun paramètre : envoyez un corps vide, `{}`.

```bash tab="curl"
curl -s https://piqline.com/api/v1/tools/listWatchContracts \
  -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/listWatchContracts", {
  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/listWatchContracts",
    headers={"Authorization": "Bearer " + os.environ["PIQLINE_API_KEY"]},
    json={},
)
output = response.json()["output"]
```

### `checkInvestigation`

État de la dernière enquête Edge, ou d’une enquête donnée : en attente, en cours, terminée avec ses candidats, ou en échec.

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

Type : Lecture. Scopes : `read`.

| Paramètre | Type | Requis | Description |
| --- | --- | --- | --- |
| `missionId` | `string` | Non | Omit to read the latest investigator mission of this workspace |

```bash tab="curl"
curl -s https://piqline.com/api/v1/tools/checkInvestigation \
  -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/checkInvestigation", {
  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/checkInvestigation",
    headers={"Authorization": "Bearer " + os.environ["PIQLINE_API_KEY"]},
    json={},
)
output = response.json()["output"]
```

### `checkHunt`

État de la dernière chasse, ou d’une chasse donnée : étape, personnes trouvées avec le verdict du code et le vôtre, et pour chaque critère son statut et ses preuves publiques datées (adresse, date, extrait). Jamais une coordonnée.

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

Type : Lecture. Scopes : `read`.

| Paramètre | Type | Requis | Description |
| --- | --- | --- | --- |
| `missionId` | `string` | Non | Omit to read the latest hunt of this workspace. |

```bash tab="curl"
curl -s https://piqline.com/api/v1/tools/checkHunt \
  -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/checkHunt", {
  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/checkHunt",
    headers={"Authorization": "Bearer " + os.environ["PIQLINE_API_KEY"]},
    json={},
)
output = response.json()["output"]
```

### `planSourcePack`

Propose un ensemble cohérent de sources à suivre pour un objectif. Ne crée rien.

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

Type : Lecture. Scopes : `read`.

| Paramètre | Type | Requis | Description |
| --- | --- | --- | --- |
| `name` | `string` | Oui |  |
| `rationale` | `string` | Oui | Why this pack answers the goal |
| `candidates` | `array<object>` | Oui |  |

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

response = requests.post(
    "https://piqline.com/api/v1/tools/planSourcePack",
    headers={"Authorization": "Bearer " + os.environ["PIQLINE_API_KEY"]},
    json={
        "name": "texte",
        "rationale": "texte",
        "candidates": [
            {
                "platform": "instagram",
                "target": "texte",
                "label": "texte",
                "why": "texte",
                "confidence": "high",
            },
        ],
    },
)
output = response.json()["output"]
```

### `listWidgets`

Widgets proposables pour un board de ce workspace, classés pour la personne, avec leurs raisons.

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

Type : Lecture. Scopes : `read`.

| Paramètre | Type | Requis | Description |
| --- | --- | --- | --- |
| `period` | `7d \| 30d \| 90d` | Non | Window used by isProposable. Default 7d. |

```bash tab="curl"
curl -s https://piqline.com/api/v1/tools/listWidgets \
  -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/listWidgets", {
  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/listWidgets",
    headers={"Authorization": "Bearer " + os.environ["PIQLINE_API_KEY"]},
    json={},
)
output = response.json()["output"]
```

### `getAdvertiserCampaigns`

Dossier publicitaire d’un annonceur des collectes du workspace : annonces, en diffusion, dates, bibliothèques, pays, besoins lus, nouvelles annonces par mois et montées en puissance, dernières annonces, signaux. Jamais une personne. Aucun crédit.

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

Type : Lecture. Scopes : `read`.

| Paramètre | Type | Requis | Description |
| --- | --- | --- | --- |
| `advertiser` | `string` | Oui | Name (or part of it) of the advertiser. |

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

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

### `listAdSignals`

Signaux publicitaires du workspace, calculés chaque heure : campagne démarrée ou arrêtée, montée en puissance, nouveau pays, nouvelle plateforme, recrutement payé, promotion, lancement, nouvel annonceur. Aucun crédit.

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

Type : Lecture. Scopes : `read`.

| Paramètre | Type | Requis | Description |
| --- | --- | --- | --- |
| `kind` | `ad_campaign_started \| ad_campaign_stopped \| ad_ramp_up \| ad_new_country \| ad_new_platform \| ad_hiring \| ad_promotion \| ad_launch \| …` | Non | ad_hiring for paid recruitment campaigns, ad_campaign_started for new campaigns, etc. |
| `activeOnly` | `boolean` | Non |  |
| `limit` | `integer` | Non |  |

```bash tab="curl"
curl -s https://piqline.com/api/v1/tools/listAdSignals \
  -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/listAdSignals", {
  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/listAdSignals",
    headers={"Authorization": "Bearer " + os.environ["PIQLINE_API_KEY"]},
    json={},
)
output = response.json()["output"]
```

### `listCollectedAds`

Collectes publicitaires du workspace (Meta, TikTok, Google, LinkedIn), déjà lues : la liste, ou, avec le nom d’une collecte, ses répartitions (angles, offres, tons, formats), son rythme, ses annonces les plus longues et ses annonces filtrables par bibliothèque, statut, angle ou mot. Aucun crédit.

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

Type : Lecture. Scopes : `read`.

| Paramètre | Type | Requis | Description |
| --- | --- | --- | --- |
| `collection` | `string` | Non | Name of a collection (exact, start or fragment). |
| `library` | `meta \| tiktok \| google \| linkedin` | Non |  |
| `status` | `live \| new` | Non | live: active or shown within 14 days. new: first seen at the last pass. |
| `angle` | `promotion \| lancement \| marque \| preuve_sociale \| education \| recrutement \| evenement \| lead \| …` | Non |  |
| `query` | `string` | Non | Word to find in the advertiser, title, text, button or transcript. |
| `limit` | `integer` | Non |  |

```bash tab="curl"
curl -s https://piqline.com/api/v1/tools/listCollectedAds \
  -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/listCollectedAds", {
  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/listCollectedAds",
    headers={"Authorization": "Bearer " + os.environ["PIQLINE_API_KEY"]},
    json={},
)
output = response.json()["output"]
```
