News Verify API

Integra News Verify
nel tuo CMS editoriale

Un'unica chiamata API certifica l'articolo su IPFS, genera il Certification Grade e restituisce il badge embeddabile. Compatibile con WordPress, Ghost, Drupal e qualsiasi CMS con supporto webhook o REST.

Quick Start — 3 passi

01
Registrati e genera la chiave
Crea un account, accedi alla dashboard e genera una API Key per News Verify.
02
Chiama l'endpoint
POST /api/v1/verify con il testo dell'articolo. Ricevi hash, grade e CID IPFS in meno di 10 secondi.
03
Mostra il badge
Usa il badge_url restituito o il shortcode WordPress per mostrare il Certification Grade nell'articolo.

Endpoint

POST/api/v1/verify

Autenticazione: Authorization: Bearer ppv_...

Request body
product_typestringrequired"news_verify"
titlestringTitolo articolo
contentstringrequiredTesto completo
source_urlstringURL pubblicazione
Response
json
{
  "document_id": 4821,
  "hash": "sha256:a1b2c3d4e5f6...",
  "verify_code": "PP-A1B2C3D4E5F6G7H8",
  "status": "completed",
  "trust_grade": "A",
  "trust_score": 91,
  "ipfs_cid": "QmXyz1234...",
  "ipfs_url": "https://ipfs.io/ipfs/QmXyz1234...",
  "badge_url": "https://proofpressverify.com/api/v1/badge/sha256:a1b2c3d4.svg",
  "certificate_url": "https://proofpressverify.com/certificate/sha256:a1b2c3d4",
  "claims_count": 7,
  "corroboration_sources": 12
}

Esempi di codice

bash
curl -X POST https://proofpressverify.com/api/v1/verify \
  -H "Authorization: Bearer ppv_YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "product_type": "news_verify",
    "title": "Titolo dell articolo",
    "content": "Testo completo dell articolo...",
    "source_url": "https://www.testata.it/articolo-123"
  }'

Integrazioni CMS

WordPressPlugin snippet

Aggiungi questo snippet in functions.php del tuo tema o crea un plugin dedicato. La certificazione avviene automaticamente alla pubblicazione di ogni articolo. Il shortcode [proofpress_badge] mostra il badge inline.

php
<?php
// Aggiungere in functions.php del tema o in un plugin custom

add_action('publish_post', 'proofpress_certify_article', 10, 2);

function proofpress_certify_article($post_id, $post) {
    if ($post->post_type !== 'post') return;
    if (get_post_meta($post_id, '_pp_certified', true)) return;

    $api_key = get_option('proofpress_api_key');
    if (!$api_key) return;

    $response = wp_remote_post('https://proofpressverify.com/api/v1/verify', [
        'headers' => [
            'Authorization' => 'Bearer ' . $api_key,
            'Content-Type'  => 'application/json',
        ],
        'body' => json_encode([
            'product_type' => 'news_verify',
            'title'        => $post->post_title,
            'content'      => wp_strip_all_tags($post->post_content),
            'source_url'   => get_permalink($post_id),
        ]),
        'timeout' => 30,
    ]);

    if (!is_wp_error($response)) {
        $cert = json_decode(wp_remote_retrieve_body($response), true);
        update_post_meta($post_id, '_pp_certified', true);
        update_post_meta($post_id, '_pp_grade', $cert['trust_grade'] ?? '');
        update_post_meta($post_id, '_pp_hash', $cert['hash'] ?? '');
        update_post_meta($post_id, '_pp_verify_code', $cert['verify_code'] ?? '');
        update_post_meta($post_id, '_pp_ipfs_url', $cert['ipfs_url'] ?? '');
    }
}

// Shortcode per mostrare il badge nell'articolo: [proofpress_badge]
add_shortcode('proofpress_badge', function($atts) {
    global $post;
    $grade = get_post_meta($post->ID, '_pp_grade', true);
    $code  = get_post_meta($post->ID, '_pp_verify_code', true);
    if (!$grade) return '';
    $colors = ['A' => '#22c55e', 'B' => '#84cc16', 'C' => '#f59e0b', 'D' => '#ef4444'];
    $color  = $colors[$grade] ?? '#6b7280';
    return sprintf(
        '<div style="display:inline-flex;align-items:center;gap:8px;padding:6px 12px;border:1px solid %s;border-radius:6px;font-size:13px;">
            <span style="color:%s;font-weight:700;">Grade %s</span>
            <span style="color:#6b7280;">%s</span>
            <a href="https://proofpressverify.com/certificate/%s" target="_blank" style="color:%s;text-decoration:none;">Verifica ↗</a>
        </div>',
        $color, $color, esc_html($grade), esc_html($code),
        esc_attr(get_post_meta($post->ID, '_pp_hash', true)), $color
    );
});
GhostWebhook

In Ghost, vai su Impostazioni → Integrations → Custom Integrations e aggiungi un webhook sull'evento Post published che punta al tuo handler Node.js. Il handler chiama ProofPress e registra il certificato.

javascript
// Ghost: Impostazioni → Integrations → Custom Integrations → Add webhook
// Event: Post published
// Target URL: https://your-server.com/ghost-certify

// Handler Node.js (Express) sul tuo server:
const express = require('express');
const app = express();
app.use(express.json());

app.post('/ghost-certify', async (req, res) => {
  const post = req.body?.post?.current;
  if (!post) return res.sendStatus(400);

  const response = await fetch('https://proofpressverify.com/api/v1/verify', {
    method: 'POST',
    headers: {
      'Authorization': 'Bearer ppv_YOUR_API_KEY',
      'Content-Type': 'application/json',
    },
    body: JSON.stringify({
      product_type: 'news_verify',
      title: post.title,
      content: post.plaintext || post.html,
      source_url: post.url,
    }),
  });

  const cert = await response.json();
  console.log(`Certificato: ${cert.verify_code} — Grade: ${cert.trust_grade}`);
  
  // Opzionale: aggiornare il post Ghost con il verify_code tramite Ghost Admin API
  res.sendStatus(200);
});
Qualsiasi CMS o piattaformaREST API

Se il tuo CMS supporta webhook in uscita o plugin personalizzati, il pattern è sempre lo stesso: intercetta l'evento di pubblicazione, chiama POST /api/v1/verify con il contenuto, salva il verify_code e il badge_url nel tuo DB. Compatibile con Drupal, Contentful, Strapi, Sanity, Directus e qualsiasi headless CMS.

Drupal
Contentful
Strapi
Sanity
Directus
Webflow
Squarespace*
Wix*

* Via Zapier o Make webhook

Badge embeddabile

Inserisci il badge nell'articolo con una riga di HTML. Il badge è dinamico: si aggiorna automaticamente se il certificato viene aggiornato.

html
<!-- Badge HTML (inserire nell'articolo o nel template) -->
<img src="https://proofpressverify.com/api/v1/badge/SHA256_HASH.svg" 
     alt="ProofPress Certified" 
     style="height:28px;" />

<!-- Oppure con link alla pagina certificato -->
<a href="https://proofpressverify.com/certificate/SHA256_HASH" target="_blank">
  <img src="https://proofpressverify.com/api/v1/badge/SHA256_HASH.svg" 
       alt="ProofPress Certified" style="height:28px;" />
</a>

Pronto a certificare i tuoi articoli?

Registrati, genera la tua API Key e fai la prima certificazione in meno di 5 minuti.