Send your logs using the Coralogix REST API /singles.

## Endpoint URL

Input your Coralogix [domain](https://coralogix.com/docs/user-guides/account-management/account-settings/coralogix-domain/index.md) into the following endpoint URL: `https://ingress.[[DOMAIN_VALUE]]/logs/v1/singles`.

## Schema

### **Endpoint Details**

|              |                                                                                                                                                    |
| ------------ | -------------------------------------------------------------------------------------------------------------------------------------------------- |
| URL          | https://ingress.\[[DOMAIN_VALUE]\]/logs/v1/singles                                                                                                 |
| HTTP Method  | POST                                                                                                                                               |
| Content-Type | application/json                                                                                                                                   |
| Header       | Authorization: Bearer [Send-Your-Data API key](https://coralogix.com/docs/user-guides/account-management/api-keys/send-your-data-api-key/index.md) |

- We **recommend** sending logs in batches to minimize network calls.
- The API is limited to a message size of 2MB which is approximately 3,000 medium-sized logs.
- If you are using Ajax or a similar technology, you may need to send the data with JSON.stringify()).

### **POST Body**

An array of JSON objects which contain:

| Required | Property Name   | Property Type | Note                                                                         |
| -------- | --------------- | ------------- | ---------------------------------------------------------------------------- |
|          | timestamp       | number        | UTC milliseconds since 1970 (supports sub-millisecond via a floating point)  |
| Yes      | applicationName | string        | usually used to separate environments                                        |
| Yes      | subsystemName   | string        | usually used to separate components                                          |
|          | computerName    | string        |                                                                              |
|          | severity        | number        | 1 – Debug, 2 – Verbose, 3 – Info, 4 – Warn, 5 – Error, 6 – Critical          |
|          | category        | string        | Category field                                                               |
|          | className       | string        | Class field                                                                  |
|          | methodName      | string        | Method field                                                                 |
|          | threadId        | string        | Thread ID field                                                              |
|          | hiResTimestamp  | string        | UTC nanoseconds since 1970(supports millisecond, microsecond and nanosecond) |
| Yes      | text            | string/json   | event log                                                                    |

## Example

```bash
curl --location --request POST 'https://ingress.[[DOMAIN_VALUE]]/logs/v1/singles' \
  --header 'Content-Type: application/json' \
  --header 'Authorization: Bearer <Send-Your-Data API key>' \
  --data-raw '[{
      "applicationName": "*insert desired application name*",
      "subsystemName": "*insert desired subsystem name*",
      "computerName": "*insert computer name*",
      "severity": 3,
      "text": "this is a normal text message",
      "category": "cat-1",
      "className": "class-1",
      "methodName": "method-1",
      "threadId": "thread-1",
      "timestamp": 1675148539123.342
    }, {
      "applicationName": "*insert desired application name*",
      "subsystemName": "*insert desired subsystem name*",
      "computerName": "*insert computer name*",
      "hiResTimestamp": "1675148539789123123",
      "severity": 5,
      "text": "{\"key1\":\"val1\",\"key2\":\"val2\",\"key3\":\"val3\",\"key4\":\"val4\"}",
      "category": "DAL",
      "className": "UserManager",
      "methodName": "RegisterUser",
      "threadId": "a-352"
    }]'
```

Note

If `timestamp` is present, use milliseconds or microseconds. If not, we will inject the UTC time when the request is received.

## Coralogix Dashboard

View your logs, with all metadata fields, in your Coralogix dashboard.

## Additional resources

|                     |                                                                                             |
| ------------------- | ------------------------------------------------------------------------------------------- |
| Coralogix Endpoints | [Coralogix Endpoints](https://coralogix.com/docs/integrations/coralogix-endpoints/index.md) |

## Support

**Need help?**

Our world-class customer success team is available 24/7 to walk you through your setup and answer any questions that may come up.

Feel free to reach out to us **via our in-app chat** or by sending us an email at [support@coralogix.com](mailto:support@coralogix.com).
