> ## Documentation Index
> Fetch the complete documentation index at: https://arize-ax.mintlify.dev/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# gRPC API

> ML gRPC ingestion API for sending prediction, actual, feature, and embedding data to Arize model monitoring.

## Overview

This page documents the ML gRPC ingestion API for classic model monitoring workflows. If you're looking for the current Arize AX REST API for datasets, experiments, and broader platform automation, see [Arize REST API](/ax/rest-reference/overview).

Arize's APIs are the main ingresses for data which powers our platform. Most applications will use an existing SDK in the language of your choice, but it's important to know what the underlying API looks like first in case you want to work in a language without a current SDK implementation.

## Authentication

Arize uses API keys in conjunction with a Space id in order to authenticate request. You will receive your keys once you sign up for our product. Your API and Space id are the keys to your data castle so be sure to keep them secure. Do not share your keys in public forums including Github, StackOverflow, logs, etc. Both the API key and Space ID are is authenticated via auth headers, use `-H 'Authorization: API_KEY_VALUE' -H 'Grpc-Metadata-arize-space-id: SPACE_ID' -H 'Grpc-Metadata-sdk-language: rest`

Arize uses conventional HTTP response codes to convey resulting success or failure of a given request. Codes in the `2XX` range indicate success, `4XX` range indicate content failure, `5XX` indicate errors with Arize's edge servers.

| Status Code | Message                                         | Reason                                                        |
| ----------- | ----------------------------------------------- | ------------------------------------------------------------- |
| 200         | OK                                              | Success                                                       |
| 403         | cannot access request headers                   | Failure when accessing incoming request's headers             |
| 403         | must provide authorization header               | Missing Authorization header                                  |
| 403         | unable to validate authorization header         | Space id is not valid                                         |
| 403         | invalid api-key                                 | API Key is not valid                                          |
| 400         | log must include prediction or actual           | Prediction or Actual is a required field and it's not present |
| 400         | invalid feature type                            | Feature data type is not supported                            |
| 400         | timestamp must range from now back to T-90 days | Record timestamp can only be backdated up to 90 days          |
| 500         | Internal service error, contact Arize           | Internal error processing messages - Contact Arize            |

## Full Record

To send an individual prediction record, you should hit Arize's `log` API `https://api.arize.com/v1/log`

### Supported label types

| Label               | data type             |
| ------------------- | --------------------- |
| "numeric"           | double                |
| "score categorical" | Tuple (string, float) |

### Request Example (numeric label)

```sh theme={null}
curl --request POST 'https://api.arize.com/v1/log' \
--header 'Authorization: API_KEY' \
--header 'Grpc-Metadata-arize-space-id: SPACE_ID' \
--header 'Grpc-Metadata-sdk-language: rest' \
--data-raw '{
   "model_id":"example_model_id",
   "prediction_id":"ef00f52c-d6d4-4e48-84cd-70166b3f423f",
   "prediction":{
      "timestamp":"2020-10-02T00:37:30.208687Z",   //Optional, defaults to now()
      "model_version":"v0.1",
      "label":{
         "numeric":0.1
      },
      "features":{
         "feature_1_float":{
            "double":0.6604474844066184
         },
         "feature_2_str":{
            "string":"str val"
         },
         "feature_4_bool":{
            "string":"True"
         },
         "feature_2_float":{
            "double":0.02876647860632975
         },
         "feature_3_float":{
            "double":0.3358383777892534
         },
         "feature_0_np_ll":{
            "int":"77"
         },
         "feature_3_bool":{
            "string":"True"
         },
         "feature_1_str":{
            "string":"str val"
         },
         "feature_1_np_ll":{
            "int":"1"
         },
         "feature_4_float":{
            "double":0.9681327640084113
         },
         "image_embedding":{
            "embedding":{
               "vector":[
                  1.0,
                  2.0,
                  3.0
               ],
               "link_to_data":"https://my-bucket.s3.us-west-2.amazonaws.com/puppy.png"
            }
         },
         "feature_2_bool":{
            "string":"True"
         },
         "feature_2_np_ll":{
            "int":"91"
         },
         "feature_0_str":{
            "string":"str val"
         },
         "feature_4_np":{
            "double":0.543297819558724
         },
         "feature_1_bool":{
            "string":"True"
         },
         "feature_3_np":{
            "double":0.5149428483266209
         },
         "feature_4_str":{
            "string":"str val"
         },
         "nlp_embedding_sentence":{
            "embedding":{
               "vector":[
                  4.0,
                  5.0,
                  6.0,
                  7.0
               ],
               "link_to_data":"",
               "raw_data":{
                  "tokenArray":{
                     "tokens":[
                        "This is a test sentence"
                     ]
                  }
               }
            }
         },
         "feature_2_np":{
            "double":0.29966708188607294
         },
         "feature_3_np_ll":{
            "int":"46"
         },
         "feature_1_np":{
            "double":0.8751167134832335
         },
         "feature_0_np":{
            "double":0.3854629460534247
         },
         "feature_0_bool":{
            "string":"True"
         },
         "feature_4_np_ll":{
            "int":"74"
         },
         "feature_0_float":{
            "double":0.5696514798125208
         },
         "feature_3_str":{
            "string":"str val"
         },
         "nlp_embedding_tokens":{
            "embedding":{
               "vector":[
                  4.0,
                  5.0,
                  6.0,
                  7.0
               ],
               "link_to_data":"",
               "raw_data":{
                  "tokenArray":{
                     "tokens":[
                        "This",
                        "is",
                        "a",
                        "test",
                        "token",
                        "array"
                     ]
                  }
               }
            }
         }
      },
      "tags":{
         "tag_str":{
            "string":"arize"
         },
         "tag_int":{
            "int":"0"
         },
         "tag_double":{
            "double":20.2
         },
         "tag_bool":{
            "string":"True"
         }
      }
   },
   "actual":{
      "label":{
         "numeric":0.1
      },
      "tags":{
         "tag_str":{
            "string":"arize"
         },
         "tag_int":{
            "int":"0"
         },
         "tag_double":{
            "double":20.2
         },
         "tag_bool":{
            "string":"True"
         }
      }
   },
   "environment_params":{
      "production":{
         
      }
   }
}'
```

## Actual

To send an individual actual record, you should hit Arize's `log` API `https://api.arize.com/v1/log`

### Supported label types

| Label               | data type             |
| ------------------- | --------------------- |
| "numeric"           | double                |
| "score categorical" | Tuple (string, float) |

### Request Example (score categorical label)

```sh theme={null}
curl --request POST 'https://api.arize.com/v1/log' \
--header 'Authorization: API_KEY' \
--header 'Grpc-Metadata-arize-space-id: SPACE_ID' \
--header 'Grpc-Metadata-sdk-language: rest' \
--data-raw '
{
   "model_id":"example_model_id",                          //Required
   "prediction_id":"027ed30c-6333-4eab-9492-61e117b1b46f", //Required
   "actual":{                                              //Required
      "label":{
         "score_categorical":{
            "score_category":{
               "category":"orange",
               "score":1.0
            }
         }
      }
   },
   "environment_params":{                                  //Required
      "production":{
         
      }
   }
}'
```

<Info>
  Questions? Email us at [support@arize.com](mailto::support@arize.com) or [Slack us](https://arize-ai.slack.com/) in the #arize-support channel
</Info>
