Back

Circle API Essential Guide

Aug 11, 20246 minute read

What type of API does Circle provide?

Circle, a financial technology company specializing in digital currencies and blockchain technologies, utilizes a REST API for its platform. REST (Representational State Transfer) is a widely adopted architectural style for designing networked applications.

Key characteristics of REST APIs:

  • Resource-Based: REST APIs organize data around resources, which can be accessed through URLs. Each URL represents a specific resource or collection of resources.
  • Stateless: In REST, each request from client to server must contain all the information needed to understand and process the request. The server does not store any state about the latest HTTP request the client made.
  • HTTP Methods: REST uses standard HTTP methods like GET, POST, PUT, DELETE to perform operations on resources.
  • Status Codes: RESTful services use HTTP status codes to indicate success or failure of an operation.
  • Media Types: REST APIs support various media types for requests and responses, commonly JSON or XML.

Given Circle's focus on financial transactions, digital currencies, and blockchain technologies, a REST API would offer a straightforward and standardized way to interact with their services, allowing for CRUD (Create, Read, Update, Delete) operations on resources such as accounts, transactions, and balances.

Does the Circle API have webhooks?

Yes, the official Circle API does support webhooks. Webhooks are an automated method for apps to receive notifications the moment a transaction is completed or fails to complete. Instead of having your application continuously poll Circle to check if an operation has been completed on the blockchain, Circle will make a request to your application once the operation is finished. This automatic notification system ensures that your app receives real-time updates without needing to actively query Circle's servers.

Types of Events You Can Subscribe To

Typically, financial and payment-related APIs offer webhooks for events such as:

  • Transaction Completion: Notifications when a transaction is successfully completed.
  • Transaction Failure: Alerts when a transaction fails due to insufficient funds, incorrect details, or other errors.
  • Account Balance Updates: Notifications when there are significant changes to an account balance, possibly due to deposits, withdrawals, or fees.
  • Security Alerts: Alerts for potential security issues, such as unauthorized access attempts or suspicious activity.

Given the nature of Circle's operations, which involve digital currency transactions, it's reasonable to expect that their webhook system would cover a range of transactional events similar to those listed above. However, for precise details on the types of events you can subscribe to with Circle's API, it's essential to consult the official Circle API documentation or contact their support team directly.

Setting Up Webhook Subscriptions

To set up webhook subscriptions with Circle, you would typically follow these steps:

  1. Navigate to Developer → Subscriptions in either the Sandbox or Production environment through the Circle UI.
  2. Enter an endpoint URL where you want notifications to be sent. This URL should point to a server under your control that is prepared to receive POST requests containing JSON payloads with details about the event.
  3. Configure the types of events you wish to subscribe to, based on what's available in the Circle API documentation.

It's important to note that subscriptions in the sandbox environment are automatically removed after 30 days, so you may need to reconfigure them periodically during development and testing phases.

Conclusion

For detailed information on event types and how to implement webhook subscriptions with Circle's API, refer to the official Circle API documentation or reach out to their support team.

Rate Limits and other limitations

The Circle API implements rate limits to ensure optimum performance, availability, stability, and reliability of its Web3 Services. These rate limits apply per second (RPS) per developer entity. The default limit across all Programmable Wallets APIs is set at 5 requests per second. However, certain endpoints have custom rate limits as follows:

  • POST /v1/w3s/developer/wallets: 10 RPS
  • POST /v1/w3s/transactions/transfer/estimateFee: 10 RPS
  • POST /v1/w3s/transactions/contractExecution/estimateFee: 10 RPS
  • POST /v1/w3s/users/token: 10 RPS
  • POST /v1/w3s/user/sign/transaction: 10 RPS
  • GET for all endpoints: 20 RPS

These limits are designed to manage the load on Circle's Web3 Services effectively, ensuring that the platform remains responsive and reliable for all users. Developers integrating with the Circle API should design their applications to stay within these rate limits to avoid disruptions in service.

Latest API Version

Based on the information provided, the most recent version of the Circle API mentioned across the sources is API v2 from CircleCI. This version introduces several new features and improvements over the previous API v1.1, including support for pipelines and pipeline parameters, among others. It's important to note that CircleCI recommends migrating scripts to API v2 stable endpoints as soon as possible, indicating that API v2 is the current focus for development and support.

Key points to consider regarding CircleCI API v2 include:

  • New Features: API v2 introduces several powerful features that were unavailable in API v1.1, such as support for pipelines and pipeline parameters.
  • Authentication: Authentication in API v2 is done by sending a Personal API token as an HTTP header named Circle-Token.
  • Endpoints: API v2 includes a variety of new endpoints for workflows, jobs, projects, pipelines, and insights, enhancing the capabilities for interacting with CircleCI services programmatically.
  • Deprecation: While both API v1.1 and API v2 are currently supported, CircleCI plans to eventually End-Of-Life (EOL) API v1.1 in favor of API v2, although a specific timeline for this transition has not been provided.

It's recommended to refer to the official CircleCI API v2 Reference Guide for a comprehensive list of endpoints, required and optional parameters, HTTP status and error codes, and code samples to effectively utilize the API in your workflows.

How to get a Circle developer account and API Keys?

Sign Up for a Developer Account

  1. Go to the Circle Developer signup page at console.circle.com/signup.

  2. Enter your name, email address, and create a password to sign up for a free Circle Developer account.

  3. Once signed up, you'll have access to the Circle Developer dashboard where you can manage API keys, subscribe to notifications, view API logs, and more.

Create an API Key

  1. Log in to your Circle Developer account.

  2. Navigate to the "API Keys" section in the left sidebar.

  3. Click on "CREATE A KEY".

  4. Enter a name for your API key.

  5. Choose the type of API key:

    • Standard: Full read/write access to all APIs
    • Restricted Access: Customized permissions for specific products/services
  6. For restricted keys, select the products/services and permission levels (No permission, Read, or Read/Write).

  7. Generate and securely store your API key.

Key Points to Consider

  • The Circle Developer account is free and quick to set up.
  • API keys allow you to authenticate and make requests to Circle's APIs.
  • You can create multiple API keys with different permission levels for various use cases.
  • Always keep your API keys secure and never share them publicly.

Best Practices

  • Use restricted access API keys when possible to limit permissions.
  • Rotate API keys periodically for security.
  • Monitor your API usage and logs in the developer dashboard.
  • Refer to Circle's API documentation for details on available endpoints and request formats.

What can you do with the Circle API?

Based on the information provided, the Circle API enables interaction with various data models to facilitate programmable wallet operations, infrastructure management, and integration with blockchain technologies. Here's a breakdown of the capabilities associated with each data model mentioned in the sources:

  • Programmable Wallets: Allows for the creation and management of wallets that can execute transactions on supported blockchains. This includes sending and receiving cryptocurrencies, interacting with smart contracts, and managing wallet balances.

  • Wallet Signing Service: Provides functionality for securely signing transactions and messages. This service ensures that transactions are valid and authorized by the wallet owner before they are broadcasted to the blockchain network.

  • Infrastructure Models: Offers tools and services for building blockchain infrastructure. This can include services for deploying smart contracts, managing blockchain nodes, and interacting with decentralized applications (DApps).

  • Account Type: Likely refers to managing different types of accounts within the Circle ecosystem, including user accounts, merchant accounts, and possibly smart contract accounts. This could involve operations such as account creation, balance inquiries, and transaction history retrieval.

  • Smart Contract Platform: Enables interaction with smart contracts deployed on supported blockchains. This includes deploying new contracts, calling contract functions, and querying contract state. Smart contracts are self-executing contracts with the terms of the agreement directly written into code.

  • Gas Station: Manages gas fees associated with transactions on blockchain networks. This service might help optimize gas costs, manage gas price fluctuations, and ensure timely execution of transactions.

  • Circle Access Network (Beta): Although details are sparse, this likely involves services for accessing Circle's network features, possibly including API access management, rate limiting, and authentication services.

  • Supported Blockchains and Currencies: Provides information and tools related to the blockchains and cryptocurrencies supported by Circle's Web3 Services. This could include details on transaction formats, network compatibility, and currency conversion rates.

Each of these data models serves a unique purpose within the Circle API ecosystem, enabling developers to build complex applications that leverage blockchain technology for payments, digital asset management, and decentralized finance (DeFi) solutions.