# Action

> Agir sur les sources et les règles. 12 outils, avec leurs paramètres et des exemples d’appel.

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

Outils d’action de l’agent Piqline. Dans le chat, chacun demande une confirmation. Par l’API, l’appel direct avec le scope `act` vaut confirmation : n’appelez ces outils qu’après l’accord de la personne concernée.

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.

### `subscribeSource`

S’abonne à une nouvelle source. Lance une vraie collecte (jobs de lecture, quotas des plateformes).

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

Type : Action. Scopes : `act`.

| Paramètre | Type | Requis | Description |
| --- | --- | --- | --- |
| `platform` | `instagram \| tiktok \| youtube \| twitter \| x \| threads \| linkedin \| reddit \| …` | Oui |  |
| `target` | `string` | Non | Handle, URL, mot-clé Marketplace, ou communauté. Une recherche LinkedIn peut s’appuyer sur query. |
| `title` | `string` | Non |  |
| `facebookKind` | `page \| group \| marketplace` | Non | Facebook : page publique, groupe public, ou recherche Marketplace. |
| `tiktokKind` | `profile \| live` | Non | TikTok only. live = /v1/tiktok/user/live probe, not profile posts. |
| `linkedinKind` | `company \| search` | Non | LinkedIn only. search = recurring public-post search on `query`. |
| `location` | `string` | Non | Marketplace : ville ou zone. |
| `lat` | `number` | Non |  |
| `lng` | `number` | Non |  |
| `radiusKm` | `number` | Non |  |
| `minPrice` | `number` | Non |  |
| `maxPrice` | `number` | Non |  |
| `sortBy` | `string` | Non |  |
| `condition` | `string` | Non |  |
| `dateListed` | `string` | Non |  |
| `categoryId` | `string` | Non |  |
| `delivery` | `string` | Non |  |
| `availability` | `string` | Non |  |
| `datePosted` | `last-hour \| last-day \| last-week \| last-month \| last-year` | Non | LinkedIn search only. Window of each run, default last-week. |
| `query` | `string` | Non | Marketplace keyword or LinkedIn search query. |
| `intent` | `string` | Non | LinkedIn search: the user's ask, kept on the source. |
| `detectionEvent` | `hiring \| funding \| launch \| expansion \| reorg \| open_to_work \| leaving \| interested_comment \| …` | Non |  |
| `detectionRounds` | `array<pre_seed \| seed \| series_a \| series_b \| series_c \| series_d \| bridge \| extension \| …>` | Non |  |
| `detectionSectors` | `array<string>` | Non |  |
| `detectionGeos` | `array<string>` | Non |  |
| `detectionVocabulary` | `array<string>` | Non |  |
| `moreQueries` | `array<string>` | Non | LinkedIn search only. Up to 3 other phrases followed together with `query`, one per job family, each probed by probeLinkedinWatch with at least one relevant post. |
| `maxPosts` | `integer` | Non | LinkedIn search only. Posts read at most per run: 15, 50, 100 or 200 (default 50). Each post read uses credits; a run reads only posts newer than the last one stored. |
| `detectionAuthors` | `array<recruiter \| founder \| manager>` | Non | LinkedIn search only. Keep only posts whose author's title reads as one of these roles (recruiter, founder, manager). Empty = every author. |
| `rhythm` | `hourly \| every_6h \| daily \| weekly` | Non | LinkedIn search only. Run rhythm chosen by the user (hourly, every_6h, daily, weekly). Omit to keep the rhythm suggested by the probe. |
| `investigation` | `object` | Non | Lot 7: pass the investigation object from probeLinkedinWatch unchanged. |
| `trackItemVariations` | `boolean` | Non | Marketplace / listing only. True only if the user explicitly asked to follow price, text or presence on the same item (T8). Default false: new items only. |
| `enrichFromUrl` | `boolean` | Non | Listing / web only. Open each item URL to read the page text. Default false. Each opened page uses credits. Set true only if the user explicitly asked. |

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

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

### `subscribeSources`

S’abonne à plusieurs sources en un appel et renvoie un résultat par source.

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

Type : Action. Scopes : `act`.

| Paramètre | Type | Requis | Description |
| --- | --- | --- | --- |
| `sources` | `array<object>` | Oui |  |

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

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

### `unsubscribeSource`

Arrête le suivi d’une source. Les items déjà collectés restent dans le corpus.

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

Type : Action. Scopes : `act`.

| Paramètre | Type | Requis | Description |
| --- | --- | --- | --- |
| `sourceId` | `string` | Oui |  |
| `label` | `string` | Non | Nom lisible de la source (celui de listSources). Obligatoire pour la carte de confirmation. |

```bash tab="curl"
curl -s https://piqline.com/api/v1/tools/unsubscribeSource \
  -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/unsubscribeSource", {
  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/unsubscribeSource",
    headers={"Authorization": "Bearer " + os.environ["PIQLINE_API_KEY"]},
    json={
        "sourceId": "5a0e9c1f-2b7d-4e63-8f14-d3c8a6b92e70",
    },
)
output = response.json()["output"]
```

### `setHomeDashboard`

Définit un board enregistré comme accueil du workspace.

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

Type : Action. Scopes : `act`.

| Paramètre | Type | Requis | Description |
| --- | --- | --- | --- |
| `dashboardId` | `string` | Oui |  |
| `title` | `string` | Non | Titre du tableau, pour la carte de confirmation. Jamais l’identifiant seul. |

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

### `upsertSignalRule`

Crée ou met à jour une règle de signal de persistance : elle se déclenche quand un item reste en ligne plus longtemps que le seuil.

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

Type : Action. Scopes : `act`.

| Paramètre | Type | Requis | Description |
| --- | --- | --- | --- |
| `ruleId` | `string` | Non |  |
| `thresholdDays` | `integer` | Non |  |
| `staleGraceDays` | `integer` | Non |  |
| `itemTypes` | `array<post \| video \| article \| listing \| job_offer>` | Non |  |
| `enabled` | `boolean` | Non |  |

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

### `upsertQuestionRule`

Crée ou met à jour une question permanente : une phrase en langage courant que Jev pose sur chaque nouvel item des sources du workspace. Le seuil de probabilité fait le signal.

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

Type : Action. Scopes : `act`.

| Paramètre | Type | Requis | Description |
| --- | --- | --- | --- |
| `ruleId` | `string` | Non |  |
| `question` | `string` | Oui |  |
| `minProbability` | `number` | Non |  |
| `itemTypes` | `array<post \| video \| article \| listing \| job_offer>` | Non |  |
| `enabled` | `boolean` | Non |  |

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

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

### `startInvestigation`

Met en file une enquête Edge en arrière-plan pour ce workspace (owner ou admin).

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

Type : Action. Scopes : `act`.

| Paramètre | Type | Requis | Description |
| --- | --- | --- | --- |
| `intent` | `string` | Oui | Need in one sentence, from sujets / zones / langues already noted |
| `perimeter` | `object` | Non | Optional sectors, geos, accounts, seed URLs from the need profile |

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

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

### `startHunt`

Lance une chasse : trouver des personnes qui remplissent des critères vérifiables, chaque critère prouvé par une source publique datée. Critères sensibles refusés, aucune coordonnée rendue. Tourne en arrière-plan et consomme des crédits du mois ; owner ou admin.

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

Type : Action. Scopes : `act`.

| Paramètre | Type | Requis | Description |
| --- | --- | --- | --- |
| `brief` | `string` | Oui | Who to find, in one or two sentences. |
| `purpose` | `string` | Oui | Why these people are sought, in one sentence. Recorded with the hunt. |
| `criteria` | `array<object>` | Oui |  |
| `target` | `integer` | Non | How many people to find. |

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

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

### `buildAdAudit`

Audit rétroactif des campagnes de 1 à 6 annonceurs déjà collectés, sur N mois : une table du workspace (annonceur, mois, nouvelles annonces, arrêts, bibliothèques, pays, besoins lus, montée en puissance) et les chiffres d’un résumé cité. Aucun crédit.

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

Type : Écriture. Scopes : `write`.

| Paramètre | Type | Requis | Description |
| --- | --- | --- | --- |
| `advertisers` | `array<string>` | Oui | Names of the advertisers, as in the collections. |
| `months` | `integer` | Non |  |
| `name` | `string` | Non | Table name. Default: « Audit publicitaire ». |

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

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

### `findCreatorSponsors`

Qui paie des créateurs YouTube dans une niche : recherche de vidéos récentes, sponsors inférés de chaque vidéo, table « Sponsors · niche » du workspace. Consomme des crédits ; confirmation dans le chat, owner ou admin.

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

Type : Action. Scopes : `act`, `write`, `explore`.

| Paramètre | Type | Requis | Description |
| --- | --- | --- | --- |
| `niche` | `string` | Oui | Words of the niche, as a creator would title a video (« compléments alimentaires »). |
| `videos` | `integer` | Non |  |
| `period` | `this_week \| this_month \| this_year` | Non |  |
| `country` | `string` | Non | YouTube region, FR by default. |
| `follow` | `boolean` | Non | true: follow the niche, run again every week, and raise A13 when a brand starts sponsoring creators of the niche (in the bell and alert e-mails). |

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

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

### `importAdHistory`

Importe l’historique Google d’une collecte annonceur : jusqu’à 20 pages (environ 800 annonces depuis 2021) pour dater les campagnes passées. Consomme des crédits ; confirmation dans le chat, owner ou admin.

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

Type : Action. Scopes : `act`, `write`, `explore`.

| Paramètre | Type | Requis | Description |
| --- | --- | --- | --- |
| `collection` | `string` | Oui | Name of the advertiser collection. |

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

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

### `startAdCollection`

Lance une collecte publicitaire sur un annonceur (nom ou domaine) ou un mot-clé : lit Meta, TikTok, Google et LinkedIn, met chaque annonce au même format, puis lit l’angle, l’offre, l’audience et le ton. Consomme des crédits ; confirmation dans le chat, owner ou admin.

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

Type : Action. Scopes : `act`, `write`, `explore`.

| Paramètre | Type | Requis | Description |
| --- | --- | --- | --- |
| `query` | `string` | Oui | Nom ou domaine de l'annonceur (kind advertiser), ou mot-clé (kind keyword). |
| `kind` | `advertiser \| keyword` | Non |  |
| `libraries` | `array<meta \| tiktok \| google \| linkedin>` | Non | Bibliothèques à lire. Google ne cherche pas par mot-clé. |
| `country` | `string` | Non | Code pays ISO. Restreint Meta et LinkedIn, choisit l'entité annonceur de Google (FR par défaut). Courants : FR, BE, CH, LU, DE, ES, IT, NL, GB, IE, US, CA, MA, SN, CI, AU, BR, JP. |
| `depth` | `apercu \| large` | Non | apercu : une page par bibliothèque. large : jusqu'à quatre pages (plus long). |
| `cadence` | `manuel \| quotidien \| hebdomadaire` | Non | manuel : à la main. quotidien ou hebdomadaire : la collecte se repasse seule, dans le plafond du jour, et ses signaux arrivent dans la cloche. |

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