Introduction
Familiarize with resources, response codes, and authentication.
Base URL
The Metal API is available at the following URL:
Authentication
Metal uses API keys to authenticate requests. You can view and manage your API keys in the Metal Application. There are two headers that youβll retrieve from each Key.
API Key Headers
Title | Header | Example Key |
---|---|---|
API Key | x-metal-api-key | pk_1234567890 |
Client ID | x-metal-client-id | ci_1234567890 |
Example Authenticated Request
Response Codes
Metal uses conventional HTTP response codes to indicate the success or failure of an API request. In general, codes in the 2xx
range indicate success, codes in the 4xx
range indicate an error that failed given the information provided (e.g., a required parameter was omitted, a charge failed, etc.), and codes in the 5xx
range indicate an error with Metalβs servers.
Code | Description |
---|---|
200 | OK - Everything worked as expected. |
400 | Bad Request - Often missing a required parameter. |
401 | Unauthorized - No valid API key provided. |
402 | Request Failed - Parameters were valid but request failed. |
404 | Not Found - The requested item doesnβt exist. |
422 | Usage Limit Exceeded - Hit a feature or usage limit based on your plan. |
429 | Rate Limit Exceeded - Too many requests hit the API too quickly. |
5xx | Server Errors - something went wrong on Metalβs end. |
Normal pagination
For certain endpoints, such as /v1/indexes/:id/documents
, pagination can be achieved using the page
and limit
query parameters.
Both page and limit should be positive integers with a maximum value of 100. This constraint means that using this method, callers can retrieve a maximum of 10,000
(i.e., 100
* 100
) records.
Deep pagination
To fetch documents beyond the limitations of normal pagination, you should utilize the lastObjectIdSeen
value returned. This ID enables the API to access data from a deeper point in the dataset. Below is an illustrative script to demonstrate this approach: