# Azioni

> Agire su fonti e regole. 12 tool, con i loro parametri ed esempi di chiamata.

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

Tool di azione dell'agente Piqline. Nella chat, ciascuno chiede conferma. Tramite l'API, una chiamata diretta con lo scope `act` vale come conferma: chiama questi tool solo dopo che la persona interessata ha dato il suo consenso.

Ogni chiamata è una richiesta `POST` con la chiave in `Authorization: Bearer`. Il corpo JSON è l'input del tool, e la risposta ha la forma `{ "tool": "nom", "output": … }`. Gli esempi contengono solo i parametri obbligatori. Le descrizioni dei parametri sono quelle che leggono gli agenti.

### `subscribeSource`

Si iscrive a una nuova fonte. Avvia una vera raccolta (job di lettura, quote delle piattaforme).

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

Tipo: Azione. Scope: `act`.

| Parametro | Tipo | Obbligatorio | Descrizione |
| --- | --- | --- | --- |
| `platform` | `instagram \| tiktok \| youtube \| twitter \| x \| threads \| linkedin \| reddit \| …` | Sì |  |
| `target` | `string` | No | Handle, URL, mot-clé Marketplace, ou communauté. Une recherche LinkedIn peut s’appuyer sur query. |
| `title` | `string` | No |  |
| `facebookKind` | `page \| group \| marketplace` | No | Facebook : page publique, groupe public, ou recherche Marketplace. |
| `tiktokKind` | `profile \| live` | No | TikTok only. live = /v1/tiktok/user/live probe, not profile posts. |
| `linkedinKind` | `company \| search` | No | LinkedIn only. search = recurring public-post search on `query`. |
| `location` | `string` | No | Marketplace : ville ou zone. |
| `lat` | `number` | No |  |
| `lng` | `number` | No |  |
| `radiusKm` | `number` | No |  |
| `minPrice` | `number` | No |  |
| `maxPrice` | `number` | No |  |
| `sortBy` | `string` | No |  |
| `condition` | `string` | No |  |
| `dateListed` | `string` | No |  |
| `categoryId` | `string` | No |  |
| `delivery` | `string` | No |  |
| `availability` | `string` | No |  |
| `datePosted` | `last-hour \| last-day \| last-week \| last-month \| last-year` | No | LinkedIn search only. Window of each run, default last-week. |
| `query` | `string` | No | Marketplace keyword or LinkedIn search query. |
| `intent` | `string` | No | LinkedIn search: the user's ask, kept on the source. |
| `detectionEvent` | `hiring \| funding \| launch \| expansion \| reorg \| open_to_work \| leaving \| interested_comment \| …` | No |  |
| `detectionRounds` | `array<pre_seed \| seed \| series_a \| series_b \| series_c \| series_d \| bridge \| extension \| …>` | No |  |
| `detectionSectors` | `array<string>` | No |  |
| `detectionGeos` | `array<string>` | No |  |
| `detectionVocabulary` | `array<string>` | No |  |
| `moreQueries` | `array<string>` | No | 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` | No | 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>` | No | 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` | No | 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` | No | Lot 7: pass the investigation object from probeLinkedinWatch unchanged. |
| `trackItemVariations` | `boolean` | No | 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` | No | 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`

Si iscrive a più fonti in una sola chiamata e restituisce un risultato per fonte.

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

Tipo: Azione. Scope: `act`.

| Parametro | Tipo | Obbligatorio | Descrizione |
| --- | --- | --- | --- |
| `sources` | `array<object>` | Sì |  |

```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`

Smette di seguire una fonte. Gli elementi già raccolti restano nel corpus.

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

Tipo: Azione. Scope: `act`.

| Parametro | Tipo | Obbligatorio | Descrizione |
| --- | --- | --- | --- |
| `sourceId` | `string` | Sì |  |
| `label` | `string` | No | 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`

Imposta una board salvata come home del workspace.

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

Tipo: Azione. Scope: `act`.

| Parametro | Tipo | Obbligatorio | Descrizione |
| --- | --- | --- | --- |
| `dashboardId` | `string` | Sì |  |
| `title` | `string` | No | 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`

Crea o aggiorna una regola di segnale di persistenza: scatta quando un elemento resta online più a lungo della soglia.

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

Tipo: Azione. Scope: `act`.

| Parametro | Tipo | Obbligatorio | Descrizione |
| --- | --- | --- | --- |
| `ruleId` | `string` | No |  |
| `thresholdDays` | `integer` | No |  |
| `staleGraceDays` | `integer` | No |  |
| `itemTypes` | `array<post \| video \| article \| listing \| job_offer>` | No |  |
| `enabled` | `boolean` | No |  |

```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`

Crea o aggiorna una domanda permanente: una frase in linguaggio naturale che Jev pone a ogni nuovo elemento delle fonti del workspace. La soglia di probabilità genera il segnale.

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

Tipo: Azione. Scope: `act`.

| Parametro | Tipo | Obbligatorio | Descrizione |
| --- | --- | --- | --- |
| `ruleId` | `string` | No |  |
| `question` | `string` | Sì |  |
| `minProbability` | `number` | No |  |
| `itemTypes` | `array<post \| video \| article \| listing \| job_offer>` | No |  |
| `enabled` | `boolean` | No |  |

```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`

Mette in coda un'indagine Edge in background per questo workspace (owner o admin).

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

Tipo: Azione. Scope: `act`.

| Parametro | Tipo | Obbligatorio | Descrizione |
| --- | --- | --- | --- |
| `intent` | `string` | Sì | Need in one sentence, from sujets / zones / langues already noted |
| `perimeter` | `object` | No | 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`

Avvia una ricerca: trova persone che soddisfano criteri verificabili, con ogni criterio provato da una fonte pubblica datata. I criteri sensibili sono rifiutati, non viene restituito alcun recapito. Viene eseguita in background e consuma i crediti del mese; owner o admin.

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

Tipo: Azione. Scope: `act`.

| Parametro | Tipo | Obbligatorio | Descrizione |
| --- | --- | --- | --- |
| `brief` | `string` | Sì | Who to find, in one or two sentences. |
| `purpose` | `string` | Sì | Why these people are sought, in one sentence. Recorded with the hunt. |
| `criteria` | `array<object>` | Sì |  |
| `target` | `integer` | No | 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 retroattivo delle campagne di 1-6 inserzionisti già raccolti, su N mesi: una tabella del workspace (inserzionista, mese, nuove inserzioni, interruzioni, librerie, paesi, esigenze lette, aumento di ritmo) e le cifre di un riepilogo citato. Nessun credito.

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

Tipo: Scrittura. Scope: `write`.

| Parametro | Tipo | Obbligatorio | Descrizione |
| --- | --- | --- | --- |
| `advertisers` | `array<string>` | Sì | Names of the advertisers, as in the collections. |
| `months` | `integer` | No |  |
| `name` | `string` | No | 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`

Chi paga i creator YouTube in una nicchia: ricerca di video recenti, sponsor dedotti da ciascun video, una tabella del workspace «Sponsor · nicchia». Consuma crediti; conferma nella chat, owner o admin.

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

Tipo: Azione. Scope: `act`, `write`, `explore`.

| Parametro | Tipo | Obbligatorio | Descrizione |
| --- | --- | --- | --- |
| `niche` | `string` | Sì | Words of the niche, as a creator would title a video (« compléments alimentaires »). |
| `videos` | `integer` | No |  |
| `period` | `this_week \| this_month \| this_year` | No |  |
| `country` | `string` | No | YouTube region, FR by default. |
| `follow` | `boolean` | No | 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`

Importa la cronologia Google di una raccolta di un inserzionista: fino a 20 pagine (circa 800 inserzioni dal 2021) per datare le campagne passate. Consuma crediti; conferma nella chat, owner o admin.

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

Tipo: Azione. Scope: `act`, `write`, `explore`.

| Parametro | Tipo | Obbligatorio | Descrizione |
| --- | --- | --- | --- |
| `collection` | `string` | Sì | 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`

Avvia una raccolta di inserzioni su un inserzionista (nome o dominio) o su una parola chiave: legge Meta, TikTok, Google e LinkedIn, porta ogni inserzione nello stesso formato, poi legge l'angolo, l'offerta, il pubblico e il tono. Consuma crediti; conferma nella chat, owner o admin.

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

Tipo: Azione. Scope: `act`, `write`, `explore`.

| Parametro | Tipo | Obbligatorio | Descrizione |
| --- | --- | --- | --- |
| `query` | `string` | Sì | Nom ou domaine de l'annonceur (kind advertiser), ou mot-clé (kind keyword). |
| `kind` | `advertiser \| keyword` | No |  |
| `libraries` | `array<meta \| tiktok \| google \| linkedin>` | No | Bibliothèques à lire. Google ne cherche pas par mot-clé. |
| `country` | `string` | No | 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` | No | apercu : une page par bibliothèque. large : jusqu'à quatre pages (plus long). |
| `cadence` | `manuel \| quotidien \| hebdomadaire` | No | 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"]
```
