{
  "swagger": "2.0",
  "info": {
    "title": "Nominal data sources",
    "version": "0.1507.0",
    "description": "Send your API key as a bearer token: `Authorization: Bearer <api key>`."
  },
  "consumes": [
    "application/json"
  ],
  "produces": [
    "application/json"
  ],
  "securityDefinitions": {
    "ApiKey": {
      "type": "apiKey",
      "in": "header",
      "name": "Authorization",
      "description": "Your API key as a bearer token: `Authorization: Bearer <api key>`."
    }
  },
  "security": [
    {
      "ApiKey": []
    }
  ],
  "paths": {
    "/storage/data-source/v1": {
      "post": {
        "operationId": "NominalDataSourceService_create",
        "summary": "Create",
        "tags": [
          "Nominal Data Sources"
        ],
        "description": "Creates a data source.",
        "deprecated": true,
        "x-deprecated": "Use CatalogService#createDataset instead.",
        "parameters": [
          {
            "name": "request",
            "in": "body",
            "schema": {
              "$ref": "#/definitions/CreateNominalDataSourceRequest"
            },
            "required": true,
            "x-example": {
              "id": "<nominal data source id>"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/NominalDataSource"
            },
            "x-example": {
              "rid": "<nominal data source rid>",
              "id": "<nominal data source id>",
              "description": "<description>",
              "dataLastWrittenAt": "2026-01-01T00:00:00Z",
              "granularity": "NANOSECONDS",
              "inMemoryStreamingEnabled": true
            }
          }
        }
      }
    },
    "/storage/data-source/v1/{rid}": {
      "put": {
        "operationId": "NominalDataSourceService_update",
        "summary": "Update",
        "tags": [
          "Nominal Data Sources"
        ],
        "parameters": [
          {
            "name": "rid",
            "in": "path",
            "type": "string",
            "format": "rid",
            "x-alias": "NominalDataSourceRid",
            "required": true
          },
          {
            "name": "request",
            "in": "body",
            "schema": {
              "$ref": "#/definitions/UpdateNominalDataSourceRequest"
            },
            "required": true,
            "x-example": {
              "inMemoryStreamingEnabled": true
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/NominalDataSource"
            },
            "x-example": {
              "rid": "<nominal data source rid>",
              "id": "<nominal data source id>",
              "description": "<description>",
              "dataLastWrittenAt": "2026-01-01T00:00:00Z",
              "granularity": "NANOSECONDS",
              "inMemoryStreamingEnabled": true
            }
          }
        }
      }
    },
    "/storage/data-source/v1/batch-get": {
      "post": {
        "operationId": "NominalDataSourceService_batchGet",
        "summary": "Batch get",
        "tags": [
          "Nominal Data Sources"
        ],
        "description": "Retrieves the data sources for the given data source RIDs.\n\nExcludes data sources that do not exist or are unauthorized. A maximum of 1000 rids can be requested.",
        "parameters": [
          {
            "name": "rids",
            "in": "body",
            "schema": {
              "type": "array",
              "items": {
                "type": "string",
                "format": "rid",
                "x-alias": "NominalDataSourceRid"
              },
              "uniqueItems": true,
              "example": [
                "<nominal data source rid>"
              ]
            },
            "required": false,
            "x-example": [
              "<nominal data source rid>"
            ]
          }
        ],
        "responses": {
          "200": {
            "description": "A successful response.",
            "schema": {
              "type": "array",
              "items": {
                "$ref": "#/definitions/NominalDataSource"
              },
              "uniqueItems": true
            },
            "x-example": [
              {
                "rid": "<nominal data source rid>",
                "id": "<nominal data source id>",
                "description": "<description>",
                "dataLastWrittenAt": "2026-01-01T00:00:00Z",
                "granularity": "NANOSECONDS",
                "inMemoryStreamingEnabled": true
              }
            ]
          }
        }
      }
    },
    "/storage/data-source/v1/{rid}/last-written": {
      "put": {
        "operationId": "NominalDataSourceService_updateLastWrittenTimestamp",
        "summary": "Update last written timestamp",
        "tags": [
          "Nominal Data Sources"
        ],
        "description": "Sets the timestamp that the Nominal Data Source in question was last written to. Only needs to be called once per minute.",
        "parameters": [
          {
            "name": "rid",
            "in": "path",
            "type": "string",
            "format": "rid",
            "x-alias": "NominalDataSourceRid",
            "required": true
          },
          {
            "name": "timestamp",
            "in": "body",
            "schema": {
              "type": "string",
              "format": "date-time",
              "example": "2026-01-01T00:00:00Z"
            },
            "required": true,
            "x-example": "2026-01-01T00:00:00Z"
          }
        ],
        "responses": {
          "204": {
            "description": "No content."
          }
        }
      }
    },
    "/storage/data-source/v1/{rid}/ensure-dataset": {
      "post": {
        "operationId": "NominalDataSourceService_ensureDatasetForDataSource",
        "summary": "Ensure dataset for data source",
        "tags": [
          "Nominal Data Sources"
        ],
        "description": "Ensures a corresponding dataset exists for the given NominalDataSource. If the dataset already exists, this is a no-op. If it doesn't exist, creates one with the same UUID as the NominalDataSource. This is to facilitate the migration from NominalDataSource to Dataset.",
        "parameters": [
          {
            "name": "rid",
            "in": "path",
            "type": "string",
            "format": "rid",
            "x-alias": "NominalDataSourceRid",
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "A successful response.",
            "schema": {
              "type": "string",
              "format": "rid",
              "x-alias": "DatasetRid"
            },
            "x-example": "<dataset rid>"
          }
        }
      }
    }
  },
  "definitions": {
    "Granularity": {
      "type": "string",
      "enum": [
        "NANOSECONDS"
      ]
    },
    "CreateNominalDataSourceRequest": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string",
          "x-alias": "NominalDataSourceId",
          "description": "A human readable identifier. Must be unique within an organization."
        },
        "description": {
          "type": "string"
        },
        "granularity": {
          "allOf": [
            {
              "$ref": "#/definitions/Granularity"
            }
          ],
          "description": "Specifies the timestamp granularity of the datasource. Defaults to nanosecond granularity."
        },
        "inMemoryStreamingEnabled": {
          "type": "boolean"
        },
        "workspace": {
          "type": "string",
          "format": "rid",
          "x-alias": "WorkspaceRid",
          "description": "The workspace in which to create the datasource. If not provided, the datasource will be created in the default workspace for the user's organization, if the default workspace for the organization is configured."
        }
      },
      "required": [
        "id"
      ],
      "example": {
        "id": "<nominal data source id>"
      }
    },
    "NominalDataSource": {
      "description": "A logical grouping of series.",
      "type": "object",
      "properties": {
        "rid": {
          "type": "string",
          "format": "rid",
          "x-alias": "NominalDataSourceRid"
        },
        "id": {
          "type": "string",
          "x-alias": "NominalDataSourceId"
        },
        "description": {
          "type": "string"
        },
        "dataLastWrittenAt": {
          "type": "string",
          "format": "date-time",
          "description": "Returns the approximate timestamp at which data was written to the data source. Will be accurate to within 1 minute."
        },
        "granularity": {
          "$ref": "#/definitions/Granularity"
        },
        "inMemoryStreamingEnabled": {
          "type": "boolean"
        }
      },
      "required": [
        "rid",
        "id",
        "granularity"
      ]
    },
    "UpdateNominalDataSourceRequest": {
      "type": "object",
      "properties": {
        "inMemoryStreamingEnabled": {
          "type": "boolean"
        }
      },
      "required": [
        "inMemoryStreamingEnabled"
      ],
      "example": {
        "inMemoryStreamingEnabled": true
      }
    }
  },
  "tags": [
    {
      "name": "Nominal Data Sources",
      "x-displayName": "Nominal data sources",
      "description": "Manages data sources (logical groupings of series) that are stored by Nominal.",
      "x-errors": [
        {
          "status": 409,
          "errorCode": "CONFLICT",
          "errorName": "NominalDataSource:NominalDataSourceConflict",
          "description": "The requested data source already exists."
        },
        {
          "status": 400,
          "errorCode": "INVALID_ARGUMENT",
          "errorName": "NominalDataSource:InvalidNominalDataSource"
        },
        {
          "status": 404,
          "errorCode": "NOT_FOUND",
          "errorName": "NominalDataSource:DataSourceNotFound"
        },
        {
          "status": 404,
          "errorCode": "NOT_FOUND",
          "errorName": "NominalDataSource:DataSourcesNotFound"
        }
      ]
    }
  ]
}
