DEV Community

Alex Spinov
Alex Spinov

Posted on

Twenty CRM Has a Free API: Open-Source CRM That Replaces Salesforce and HubSpot

What is Twenty?

Twenty is an open-source CRM built with modern tech — a self-hosted alternative to Salesforce and HubSpot. It features contacts, companies, deals, tasks, emails, and a powerful GraphQL + REST API.

Free. Self-hosted. Your data stays yours.

Quick Start

npx twenty@latest init
Enter fullscreen mode Exit fullscreen mode

Or Docker:

git clone https://github.com/twentyhq/twenty
cd twenty
docker compose up -d
Enter fullscreen mode Exit fullscreen mode

The REST API

export TWENTY_URL="https://your-twenty.com/api"
export TWENTY_TOKEN="your-api-key"
Enter fullscreen mode Exit fullscreen mode

People (Contacts)

# Create contact
curl -X POST "$TWENTY_URL/rest/people" \
  -H "Authorization: Bearer $TWENTY_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "name": {"firstName": "Alice", "lastName": "Johnson"},
    "emails": {"primaryEmail": "alice@acme.com"},
    "phones": {"primaryPhoneNumber": "+1234567890"},
    "jobTitle": "CTO",
    "city": "San Francisco"
  }'

# List contacts
curl -s "$TWENTY_URL/rest/people?limit=10" \
  -H "Authorization: Bearer $TWENTY_TOKEN"

# Search contacts
curl -s "$TWENTY_URL/rest/people?filter=name.firstName[eq]=Alice" \
  -H "Authorization: Bearer $TWENTY_TOKEN"
Enter fullscreen mode Exit fullscreen mode

Companies

# Create company
curl -X POST "$TWENTY_URL/rest/companies" \
  -H "Authorization: Bearer $TWENTY_TOKEN" \
  -d '{
    "name": "Acme Corp",
    "domainName": "acme.com",
    "employees": 150,
    "idealCustomerProfile": true,
    "address": {"addressCity": "San Francisco"}
  }'

# List companies
curl -s "$TWENTY_URL/rest/companies?limit=20&order_by=name" \
  -H "Authorization: Bearer $TWENTY_TOKEN"
Enter fullscreen mode Exit fullscreen mode

Opportunities (Deals)

curl -X POST "$TWENTY_URL/rest/opportunities" \
  -H "Authorization: Bearer $TWENTY_TOKEN" \
  -d '{
    "name": "Enterprise Deal",
    "amount": {"amountMicros": 50000000000, "currencyCode": "USD"},
    "stage": "QUALIFICATION",
    "closeDate": "2026-06-30",
    "companyId": "COMPANY_ID"
  }'
Enter fullscreen mode Exit fullscreen mode

Tasks

curl -X POST "$TWENTY_URL/rest/tasks" \
  -H "Authorization: Bearer $TWENTY_TOKEN" \
  -d '{
    "title": "Follow up with Alice",
    "body": "Discuss enterprise pricing",
    "dueAt": "2026-04-01T10:00:00Z",
    "status": "TODO"
  }'
Enter fullscreen mode Exit fullscreen mode

GraphQL API

query {
  people(first: 10, orderBy: { createdAt: DescNullsLast }) {
    edges {
      node {
        id
        name { firstName lastName }
        emails { primaryEmail }
        company { name }
        jobTitle
      }
    }
  }
}

mutation {
  createPerson(data: {
    name: { firstName: "Bob", lastName: "Smith" }
    emails: { primaryEmail: "bob@startup.io" }
    jobTitle: "CEO"
  }) {
    id
    name { firstName lastName }
  }
}
Enter fullscreen mode Exit fullscreen mode

Custom Objects

Twenty supports custom objects — extend the CRM with your own data models:

# Create custom object
curl -X POST "$TWENTY_URL/rest/metadata/objects" \
  -H "Authorization: Bearer $TWENTY_TOKEN" \
  -d '{
    "nameSingular": "project",
    "namePlural": "projects",
    "labelSingular": "Project",
    "labelPlural": "Projects"
  }'
Enter fullscreen mode Exit fullscreen mode

Key Features

  • Kanban views: Drag-and-drop deal pipeline
  • Email integration: Gmail/Outlook sync
  • Calendar: Meeting scheduling
  • Custom fields: Extend any object
  • Webhooks: Real-time notifications
  • Import/Export: CSV, API

Twenty vs Alternatives

Feature Twenty Salesforce HubSpot Free
Open source Yes No No
Self-host Yes No No
Free users Unlimited N/A Limited
Custom objects Yes Yes ($) No
API REST + GraphQL REST REST
Monthly cost $0 (self) $25+/user $0-$50

Need CRM setup or sales automation?

📧 spinov001@gmail.com
🔧 My tools on Apify Store

Salesforce, HubSpot, or open-source CRM? Share your pick!

Top comments (0)