# Acciones

> Actuar sobre fuentes y reglas. 12 herramientas, con sus parámetros y ejemplos de llamada.

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

Herramientas de acción del agente Piqline. En el chat, cada una pide confirmación. Por la API, una llamada directa con el scope `act` cuenta como confirmación: llama a estas herramientas solo después de que la persona afectada lo haya aceptado.

Cada llamada es una petición `POST` con la clave en `Authorization: Bearer`. El cuerpo JSON es la entrada de la herramienta, y la respuesta tiene la forma `{ "tool": "nom", "output": … }`. Los ejemplos solo incluyen los parámetros obligatorios. Las descripciones de los parámetros son las que leen los agentes.

### `subscribeSource`

Se suscribe a una fuente nueva. Inicia una recogida real (trabajos de lectura, cuotas de plataforma).

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

Tipo: Acción. Scopes: `act`.

| Parámetro | Tipo | Obligatorio | Descripción |
| --- | --- | --- | --- |
| `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`

Se suscribe a varias fuentes en una sola llamada y devuelve un resultado por fuente.

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

Tipo: Acción. Scopes: `act`.

| Parámetro | Tipo | Obligatorio | Descripción |
| --- | --- | --- | --- |
| `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`

Deja de seguir una fuente. Los elementos ya recogidos permanecen en el corpus.

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

Tipo: Acción. Scopes: `act`.

| Parámetro | Tipo | Obligatorio | Descripción |
| --- | --- | --- | --- |
| `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`

Define un tablero guardado como página de inicio del workspace.

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

Tipo: Acción. Scopes: `act`.

| Parámetro | Tipo | Obligatorio | Descripción |
| --- | --- | --- | --- |
| `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 actualiza una regla de señal de persistencia: se activa cuando un elemento permanece en línea más tiempo que el umbral.

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

Tipo: Acción. Scopes: `act`.

| Parámetro | Tipo | Obligatorio | Descripción |
| --- | --- | --- | --- |
| `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 actualiza una pregunta permanente: una frase en lenguaje natural que Jev plantea a cada elemento nuevo de las fuentes del workspace. El umbral de probabilidad genera la señal.

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

Tipo: Acción. Scopes: `act`.

| Parámetro | Tipo | Obligatorio | Descripción |
| --- | --- | --- | --- |
| `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`

Pone en cola una investigación de Edge en segundo plano para este workspace (propietario o administrador).

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

Tipo: Acción. Scopes: `act`.

| Parámetro | Tipo | Obligatorio | Descripción |
| --- | --- | --- | --- |
| `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`

Inicia una búsqueda: encontrar personas que cumplen criterios verificables, cada criterio probado por una fuente pública fechada. Los criterios sensibles se rechazan y no se devuelve ningún dato de contacto. Se ejecuta en segundo plano y consume los créditos del mes; propietario o administrador.

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

Tipo: Acción. Scopes: `act`.

| Parámetro | Tipo | Obligatorio | Descripción |
| --- | --- | --- | --- |
| `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`

Auditoría retroactiva de las campañas de 1 a 6 anunciantes ya recogidos, a lo largo de N meses: una tabla del workspace (anunciante, mes, anuncios nuevos, paradas, bibliotecas, países, necesidades leídas, aumento de ritmo) y las cifras de un resumen citado. Sin créditos.

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

Tipo: Escritura. Scopes: `write`.

| Parámetro | Tipo | Obligatorio | Descripción |
| --- | --- | --- | --- |
| `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`

Quién paga a los creadores de YouTube en un nicho: búsqueda de vídeos recientes, patrocinadores deducidos de cada vídeo, una tabla del workspace «Patrocinadores · nicho». Consume créditos; confirmación en el chat, propietario o administrador.

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

Tipo: Acción. Scopes: `act`, `write`, `explore`.

| Parámetro | Tipo | Obligatorio | Descripción |
| --- | --- | --- | --- |
| `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 el historial de Google de una colección de anunciante: hasta 20 páginas (unos 800 anuncios desde 2021) para fechar campañas pasadas. Consume créditos; confirmación en el chat, propietario o administrador.

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

Tipo: Acción. Scopes: `act`, `write`, `explore`.

| Parámetro | Tipo | Obligatorio | Descripción |
| --- | --- | --- | --- |
| `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`

Inicia una recogida de anuncios sobre un anunciante (nombre o dominio) o una palabra clave: lee Meta, TikTok, Google y LinkedIn, pone cada anuncio en el mismo formato y luego lee el ángulo, la oferta, la audiencia y el tono. Consume créditos; confirmación en el chat, propietario o administrador.

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

Tipo: Acción. Scopes: `act`, `write`, `explore`.

| Parámetro | Tipo | Obligatorio | Descripción |
| --- | --- | --- | --- |
| `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"]
```
