A TypeScript client for the Porkbun API v3.
npm install porkbun-js
import { PorkbunAPI } from 'porkbun-js';
const client = new PorkbunAPI({
apiKey: 'YOUR_API_KEY',
secretApiKey: 'YOUR_SECRET_API_KEY'
});
// Domain operations
const domains = await client.domain.listAll();
const nameservers = await client.domain.getNameServers('example.com');
// DNS operations
const dnsRecords = await client.dns.retrieve('example.com');
await client.dns.create('example.com', {
type: 'A',
name: 'www',
content: '1.1.1.1'
});
// SSL operations
const sslBundle = await client.ssl.retrieve('example.com');
listAll(options?: DomainListOptions)
: List all domainsgetNameServers(domain: string)
: Get domain nameserversupdateNameServers(domain: string, nameservers: string[])
: Update nameserversaddUrlForward(domain: string, options: URLForwardingOptions)
: Add URL forwardinggetUrlForwarding(domain: string)
: Get URL forwarding settingsdeleteUrlForward(domain: string, id: string)
: Delete URL forwardingping()
: Test API connectivity
create(domain: string, options: DNSCreateOptions)
: Create DNS recordedit(domain: string, id: string, options: DNSEditOptions)
: Edit DNS recorddelete(domain: string, id: string)
: Delete DNS recordretrieve(domain: string, id?: string)
: Get DNS recordsretrieveByNameType(domain: string, type: DNSRecordType, subdomain: string)
: Get records by typeeditByNameType(domain: string, type: DNSRecordType, subdomain: string, options: DNSEditOptions)
: Edit by typedeleteByNameType(domain: string, type: DNSRecordType, subdomain: string)
: Delete by type
retrieve(domain: string)
: Get SSL certificate bundle
MIT
PRs welcome! Please read our contributing guidelines first.