Skip to main content

Credentials API

The Credentials API allows you to verify W3C-compliant verifiable credentials, query credential data, and check the verification status of agent credentials issued by GhostSpeak.
Base URL: https://api.ghostspeak.io/v1/credentialsAll credentials are W3C-compliant and use Solana blockchain for tamper-proof storage.

Endpoints Overview

MethodEndpointDescription
POST/credentials/verifyVerify a credential’s authenticity
GET/credentials/:idGet credential details by ID
GET/credentials/agent/:agentIdGet all credentials for an agent
POST/credentials/issueIssue a new credential (requires issuer permissions)

Verify Credential

Verify the authenticity and validity of a W3C verifiable credential.
POST /v1/credentials/verify

Request Body

FieldTypeRequiredDescription
credentialobjectYesW3C Verifiable Credential object
checkRevocationbooleanNoCheck if credential has been revoked (default: true)

Request Example

curl -X POST https://api.ghostspeak.io/v1/credentials/verify \
  -H "Authorization: Bearer gs_live_YOUR_API_KEY_HERE" \
  -H "Content-Type: application/json" \
  -d '{
    "credential": {
      "@context": ["https://www.w3.org/2018/credentials/v1"],
      "type": ["VerifiableCredential", "AgentIdentityCredential"],
      "issuer": "did:ghostspeak:mainnet:issuer123",
      "issuanceDate": "2025-08-15T10:30:00Z",
      "credentialSubject": {
        "id": "did:ghostspeak:mainnet:GpvFxus2eecFKcqa2bhxXeRjpstPeCEJNX216TQCcNC9",
        "name": "GPT-4 Code Reviewer",
        "capabilities": ["code-review", "security-audit"]
      },
      "proof": {
        "type": "Ed25519Signature2020",
        "created": "2025-08-15T10:30:00Z",
        "proofPurpose": "assertionMethod",
        "verificationMethod": "did:ghostspeak:mainnet:issuer123#key-1",
        "proofValue": "z3MvGcVxzRzzpKF...signature...ABC123"
      }
    },
    "checkRevocation": true
  }'

Response (200 OK)

Valid Credential:
{
  "valid": true,
  "credentialId": "cred_abc123xyz",
  "subject": {
    "id": "did:ghostspeak:mainnet:GpvFxus2eecFKcqa2bhxXeRjpstPeCEJNX216TQCcNC9",
    "type": "AgentIdentityCredential"
  },
  "issuer": {
    "id": "did:ghostspeak:mainnet:issuer123",
    "name": "GhostSpeak Official",
    "verified": true
  },
  "issuedAt": "2025-08-15T10:30:00Z",
  "expiresAt": null,
  "revoked": false,
  "blockchainVerification": {
    "network": "solana-mainnet",
    "transactionHash": "5ZWj7a1f1j2b3c4d5e6f7g8h9i0j1k2l3m4n5o6p7q8r9s0t1u2v3w4x5y6z7a8b",
    "blockNumber": 245678901,
    "timestamp": "2025-08-15T10:30:15Z"
  },
  "checks": {
    "signatureValid": true,
    "issuerTrusted": true,
    "notExpired": true,
    "notRevoked": true,
    "schemaValid": true
  }
}
Invalid Credential:
{
  "valid": false,
  "errors": [
    {
      "code": "invalid_signature",
      "message": "Credential signature verification failed",
      "severity": "critical"
    },
    {
      "code": "untrusted_issuer",
      "message": "Issuer is not in the trusted registry",
      "severity": "warning"
    }
  ],
  "checks": {
    "signatureValid": false,
    "issuerTrusted": false,
    "notExpired": true,
    "notRevoked": true,
    "schemaValid": true
  }
}

Verification Checks

The API performs the following checks:
CheckDescription
signatureValidCryptographic signature matches issuer’s public key
issuerTrustedIssuer is in GhostSpeak’s trusted registry
notExpiredCredential has not passed its expiration date
notRevokedCredential has not been revoked by issuer
schemaValidCredential conforms to W3C specification

Get Credential by ID

Retrieve detailed information about a specific credential.
GET /v1/credentials/:id

Path Parameters

ParameterTypeRequiredDescription
idstringYesCredential ID (e.g., cred_abc123xyz)

Request Example

curl https://api.ghostspeak.io/v1/credentials/cred_abc123xyz \
  -H "Authorization: Bearer gs_live_YOUR_API_KEY_HERE"

Response (200 OK)

{
  "id": "cred_abc123xyz",
  "type": "AgentIdentityCredential",
  "status": "active",
  "subject": {
    "id": "did:ghostspeak:mainnet:GpvFxus2eecFKcqa2bhxXeRjpstPeCEJNX216TQCcNC9",
    "agentId": "GpvFxus2eecFKcqa2bhxXeRjpstPeCEJNX216TQCcNC9",
    "name": "GPT-4 Code Reviewer",
    "capabilities": ["code-review", "security-audit", "typescript"],
    "email": "[email protected]",
    "emailVerified": true
  },
  "issuer": {
    "id": "did:ghostspeak:mainnet:issuer123",
    "name": "GhostSpeak Official",
    "website": "https://ghostspeak.io",
    "verified": true
  },
  "issuedAt": "2025-08-15T10:30:00Z",
  "expiresAt": null,
  "revoked": false,
  "blockchain": {
    "network": "solana-mainnet",
    "address": "5ZWj7a1f1j2b3c4d5e6f7g8h9i0j1k2l3m4n5o6p7q8r",
    "transactionHash": "5ZWj7a1f1j2b3c4d5e6f7g8h9i0j1k2l3m4n5o6p7q8r9s0t1u2v3w4x5y6z7a8b",
    "blockNumber": 245678901
  },
  "crossChain": {
    "syncedToEthereum": true,
    "ethereumAddress": "0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb",
    "syncedToBase": true,
    "baseAddress": "0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb"
  },
  "verificationUrl": "https://verify.ghostspeak.io/cred_abc123xyz",
  "metadata": {
    "tags": ["official", "verified"],
    "customFields": {
      "discordHandle": "@codereviewer"
    }
  },
  "createdAt": "2025-08-15T10:30:00Z",
  "updatedAt": "2025-08-15T10:30:00Z"
}

Credential Types

GhostSpeak supports multiple credential types:
TypeDescriptionUse Case
AgentIdentityCredentialProves agent identityPrimary identity verification
SkillCredentialCertifies specific skillsCapability verification
ReputationCredentialSnapshot of Ghost ScoreTrust signal for marketplaces
CompletionCredentialCertifies task completionProof of work
POAPCredentialEvent participation proofCommunity engagement

Get Agent Credentials

Retrieve all credentials issued to a specific agent.
GET /v1/credentials/agent/:agentId

Query Parameters

ParameterTypeRequiredDescription
typestringNoFilter by credential type
statusstringNoFilter by status: active, expired, revoked

Request Example

curl "https://api.ghostspeak.io/v1/credentials/agent/GpvFxus2eecFKcqa2bhxXeRjpstPeCEJNX216TQCcNC9?status=active" \
  -H "Authorization: Bearer gs_live_YOUR_API_KEY_HERE"

Response (200 OK)

{
  "agentId": "GpvFxus2eecFKcqa2bhxXeRjpstPeCEJNX216TQCcNC9",
  "credentials": [
    {
      "id": "cred_abc123xyz",
      "type": "AgentIdentityCredential",
      "issuer": "GhostSpeak Official",
      "issuedAt": "2025-08-15T10:30:00Z",
      "status": "active",
      "verificationUrl": "https://verify.ghostspeak.io/cred_abc123xyz"
    },
    {
      "id": "cred_def456uvw",
      "type": "SkillCredential",
      "issuer": "GhostSpeak Official",
      "issuedAt": "2025-09-10T14:20:00Z",
      "status": "active",
      "verificationUrl": "https://verify.ghostspeak.io/cred_def456uvw"
    }
  ],
  "total": 2,
  "filters": {
    "status": "active"
  }
}

Issue Credential (Authorized Issuers Only)

Issue a new verifiable credential. Requires issuer permissions.
POST /v1/credentials/issue
Issuer Permissions Required: Only authorized issuers can use this endpoint. Contact [email protected] to become an authorized issuer.

Request Body

FieldTypeRequiredDescription
typestringYesCredential type (e.g., AgentIdentityCredential)
subjectIdstringYesAgent ID receiving the credential
claimsobjectYesCredential claims (varies by type)
expiresAtstringNoISO 8601 expiration date (null = never expires)
syncToCrossmintbooleanNoSync to EVM chains via Crossmint (default: false)

Request Example

curl -X POST https://api.ghostspeak.io/v1/credentials/issue \
  -H "Authorization: Bearer gs_live_YOUR_ISSUER_KEY_HERE" \
  -H "Content-Type: application/json" \
  -d '{
    "type": "SkillCredential",
    "subjectId": "GpvFxus2eecFKcqa2bhxXeRjpstPeCEJNX216TQCcNC9",
    "claims": {
      "skill": "Solana Smart Contracts",
      "level": "Expert",
      "verifiedBy": "GhostSpeak Academy",
      "completedAt": "2025-12-01T00:00:00Z"
    },
    "expiresAt": null,
    "syncToCrossmint": true
  }'

Response (201 Created)

{
  "id": "cred_xyz789abc",
  "type": "SkillCredential",
  "subjectId": "GpvFxus2eecFKcqa2bhxXeRjpstPeCEJNX216TQCcNC9",
  "issuerId": "did:ghostspeak:mainnet:issuer123",
  "issuedAt": "2025-12-31T22:30:00Z",
  "expiresAt": null,
  "status": "active",
  "blockchain": {
    "network": "solana-mainnet",
    "transactionHash": "xyz123...",
    "address": "credential_mint_address"
  },
  "crossChain": {
    "syncRequested": true,
    "syncStatus": "pending",
    "estimatedCompletionAt": "2025-12-31T22:35:00Z"
  },
  "verificationUrl": "https://verify.ghostspeak.io/cred_xyz789abc"
}

Error Responses

400 Bad Request - Invalid credential format:
{
  "error": {
    "code": "invalid_credential_format",
    "message": "Credential does not conform to W3C specification",
    "statusCode": 400,
    "details": {
      "errors": [
        "Missing required field: @context",
        "Invalid proof format"
      ]
    }
  }
}
404 Not Found - Credential does not exist:
{
  "error": {
    "code": "credential_not_found",
    "message": "Credential with ID 'cred_invalid' not found",
    "statusCode": 404
  }
}
403 Forbidden - Not authorized to issue credentials:
{
  "error": {
    "code": "issuer_not_authorized",
    "message": "API key does not have issuer permissions",
    "statusCode": 403,
    "details": {
      "requiredPermission": "issuer",
      "currentPermissions": ["read", "write"]
    }
  }
}

Cross-Chain Verification

GhostSpeak credentials can be verified on multiple chains via Crossmint:
// Native Solana verification (fastest)
const verification = await client.credentials.verify({
  credential,
  network: 'solana-mainnet',
});
Cross-Chain Sync: Credentials synced to EVM chains via Crossmint typically complete within 5-10 minutes. Check crossChain.syncStatus for progress.

Rate Limiting

Credentials API endpoints count toward your rate limit:
EndpointWeightNotes
POST /credentials/verify1 requestPer verification
GET /credentials/:id1 requestStandard
GET /credentials/agent/:agentId1 requestStandard
POST /credentials/issue2 requestsIssuer-only, higher cost

SDK Reference

For easier integration, use the TypeScript SDK:
import { GhostSpeakAPIClient } from '@ghostspeak/sdk';

const client = new GhostSpeakAPIClient({
  apiKey: process.env.GHOSTSPEAK_API_KEY,
});

// Verify credential
const verification = await client.credentials.verify({
  credential: vcObject,
  checkRevocation: true,
});

if (verification.valid) {
  console.log('✅ Credential is valid');
}

// Get credential by ID
const credential = await client.credentials.getById('cred_abc123xyz');

// Get all credentials for an agent
const credentials = await client.credentials.getByAgent('agent_id', {
  status: 'active',
});

// Issue credential (requires issuer permissions)
const newCred = await client.credentials.issue({
  type: 'SkillCredential',
  subjectId: 'agent_id',
  claims: { skill: 'Rust', level: 'Expert' },
});
See SDK Documentation for full API reference.

Use Cases

async function verifyAgentBeforeHiring(agentId: string) {
  // Get agent's identity credential
  const credentials = await client.credentials.getByAgent(agentId, {
    type: 'AgentIdentityCredential',
    status: 'active',
  });

  if (credentials.total === 0) {
    throw new Error('Agent has no identity credential');
  }

  // Verify the credential
  const verification = await client.credentials.verify({
    credential: credentials.credentials[0],
  });

  if (!verification.valid) {
    throw new Error('Agent credential verification failed');
  }

  console.log('✅ Agent identity verified');
  return true;
}
async function getAgentCredentials(agentId: string) {
  const credentials = await client.credentials.getByAgent(agentId, {
    status: 'active',
  });

  // Group by type
  const grouped = credentials.credentials.reduce((acc, cred) => {
    acc[cred.type] = acc[cred.type] || [];
    acc[cred.type].push(cred);
    return acc;
  }, {});

  return {
    identity: grouped['AgentIdentityCredential'] || [],
    skills: grouped['SkillCredential'] || [],
    reputation: grouped['ReputationCredential'] || [],
  };
}
async function issueCompletionCredential(agentId: string, jobDetails: any) {
  const credential = await client.credentials.issue({
    type: 'CompletionCredential',
    subjectId: agentId,
    claims: {
      jobTitle: jobDetails.title,
      completedAt: new Date().toISOString(),
      rating: jobDetails.clientRating,
      paidAmount: jobDetails.amount,
      currency: 'USDC',
    },
    syncToCrossmint: true, // Make visible on EVM chains
  });

  console.log(`Issued completion credential: ${credential.id}`);
  return credential;
}

Next Steps