{"openapi":"3.0.1","info":{"title":"Vessel Insight Subscription API","description":"# Introduction\n\nDTN Vessel Insights Subscription API can be used by customers to self-manage vessel subscription for [DTN Vessel Insights API](https://documenter.getpostman.com/view/19830375/UVypyx2G). For questions, contact DTN customer service: [customerservice@dtn.com](mailto:customerservice@dtn.com).\n\n# Getting started\n\nMake sure that a valid token (as seen in the Auth section) is used to call the API. See below for a valid query body. You can use the [Auth0](https://shipping-cs.eu.auth0.com/oauth/token) endpoint to authenticate and get a JWT token. \n\nSubscribing a vessel to Vessel Insights API is done by sending a corresponding IMO and MMSI number to the Vessel Insight Subscription API. It is also possible to bulk subscribe vessels to Vessel Insights API using the Vessel Insight Subscription API.\n\nThe Vessel Insights API will start collecting data from the moment a vessel has been subscribed. The first set of calculations for Vessel Insights API will trigger at 0 UTC after the subscription. From here onwards, new data is added to Vessel Insights API once every day at every 0 UTC. This data covers the ships timeline from ‘0 UTC – 48 hours’ to ‘0 UTC – 24 hours’.\n\nDepending on when a customer calls the Vessel Insights API, data for last 24 to 48 hours will not be available in Vessel Insights API. Therefore, please be aware that subscribing a vessel will not immediately result in data being available in Vessel Insights API for this vessel.\n\n# Troubleshooting\n## Resource conflict\nThis error message indicates that the vessel you are trying to subscribe to Vessel Insights API is already subscribed by you or another customer with a different MMSI number than the one you provided in the subscription request. So when you tried to subscribe the same vessel (IMO) with a different MMSI number, our system noticed a conflict and gave this “Resource conflict” error. At this moment, you cannot resolve this error yourself. Please notify this to our customer service at [customerservice@dtn.com](mailto:customerservice@dtn.com) and we will fix this for you.","termsOfService":"https://www.dtn.com/subscription-agreement-standard-terms-conditions","contact":{"name":"DTN","email":"customerservice@dtn.com"},"version":"v1"},"servers":[{"url":"https://api.dev-test.stg.odyssea.zones.dtn.com"}],"paths":{"/v1/subscriptions":{"get":{"tags":["CustomerVesselSubscription"],"summary":"Gets the list of vessel subscriptions.","responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/VesselSubscriptionResponse"}}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}}},"security":[{"clientCredentials":[]}]},"post":{"tags":["CustomerVesselSubscription"],"summary":"Add bulk vessel subscriptions.","requestBody":{"description":"List of vessel subscriptions.","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/VesselSubscriptionRequest"}}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BulkVesselSubscriptionResponse"}}}},"207":{"description":"Multi status"},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}}},"security":[{"clientCredentials":[]}]}},"/v1/subscriptions/{imo}":{"delete":{"tags":["CustomerVesselSubscription"],"summary":"Delete vessel subscription.","parameters":[{"name":"imo","in":"path","description":"The vessel's imo.","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Success"},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}}},"security":[{"clientCredentials":[]}]}},"/oauth/token":{"post":{"tags":["Auth"],"summary":"Get a token","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RequestToken"}}}},"responses":{"200":{"description":null,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Token"}}}}}},"servers":[{"url":"https://shipping-cs-dev-test.eu.auth0.com"}]}},"components":{"schemas":{"BulkVesselSubscriptionResponse":{"type":"object","properties":{"succeeded":{"type":"array","items":{"$ref":"#/components/schemas/VesselSubscriptionResponse"},"description":"Contains the list of successfully created subscriptions.","nullable":true},"failed":{"type":"array","items":{"$ref":"#/components/schemas/FailedVesselSubscriptionResponse"},"description":"Contains the list of failed subscriptions.","nullable":true}},"additionalProperties":false},"Data":{"type":"object","properties":{"access_token":{"type":"string","description":"The JWT Access Token string you will use as your Bearer token.","nullable":true},"scope":{"type":"string","description":"The scopes that this Access Token gives you permissions to access.","nullable":true},"expires_in":{"type":"integer","description":"The length of time before this Access Token will expire, in seconds.","format":"int32"},"token_type":{"type":"string","description":"Verifies that this Access Token should be used as a Bearer token.","nullable":true}},"additionalProperties":false},"FailedVesselSubscriptionResponse":{"type":"object","properties":{"imo":{"type":"string","description":"The vessel's IMO number.","nullable":true},"mmsi":{"type":"integer","description":"The vessel's MMSI number.","format":"int32"},"errorMessage":{"type":"string","description":"The error description of why it fails.","nullable":true}},"additionalProperties":false},"Meta":{"type":"object","properties":{"date_time":{"type":"string","description":"DateTime Utc when the token generated/recieved.","format":"date-time"},"name":{"type":"string","description":"Name","nullable":true},"uuid":{"type":"string","description":"Identifier.","nullable":true},"start_timestamp":{"type":"integer","description":"The time the token generation started.","format":"int64"},"end_timestamp":{"type":"integer","description":"The time the token generation ended.","format":"int64"},"execution_time":{"type":"integer","description":"Token generation execution time.","format":"int32"}},"additionalProperties":false},"ProblemDetails":{"type":"object","properties":{"type":{"type":"string","nullable":true},"title":{"type":"string","nullable":true},"status":{"type":"integer","format":"int32","nullable":true},"detail":{"type":"string","nullable":true},"instance":{"type":"string","nullable":true}},"additionalProperties":{}},"RequestToken":{"type":"object","properties":{"client_id":{"type":"string","description":"Client ID as provided by DTN","nullable":true},"client_secret":{"type":"string","description":"Client secret as provided by DTN","nullable":true},"audience":{"type":"string","description":"Resource URL intended for the token, provided by DTN","default":"https://dev-test.vesselinsightssubscription.api.shipping.dtn.com","nullable":true},"grant_type":{"type":"string","description":"The type of token request","default":"client_credentials","nullable":true}},"additionalProperties":false,"description":"Request for retreiving auth tokens."},"Token":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Data"},"meta":{"$ref":"#/components/schemas/Meta"}},"additionalProperties":false,"description":"Token for authentication."},"VesselSubscriptionRequest":{"type":"object","properties":{"imo":{"type":"string","description":"The vessel's IMO number.","nullable":true},"mmsi":{"type":"integer","description":"The vessel's MMSI number.","format":"int32"}},"additionalProperties":false},"VesselSubscriptionResponse":{"type":"object","properties":{"imo":{"type":"string","description":"The vessel's IMO number.","nullable":true},"mmsi":{"type":"integer","description":"The vessel's MMSI number.","format":"int32"},"dateSubscribed":{"type":"string","description":"The date of the subscription.","format":"date-time"}},"additionalProperties":false,"description":"Vessel subscription object."}},"securitySchemes":{"clientCredentials":{"type":"oauth2","x-receive-token-in":"request-body","flows":{"clientCredentials":{"tokenUrl":"https://api.auth.dtn.com/v1/tokens/authorize"}},"description":"# Using DAIS for M2M/API Auth\nYou have been given a Client ID and a Client Secret, which are used to request a DTN Access Token. DTN Access Tokens are required when making calls to each and every DTN API endpoint. The following information provides additional details on these tokens and how they are generated.\n## What is an Access Token and how is it different from an API Key?\nAn API Key is a random string of characters that an API uses to authorize whether or not a calling client has approved access to an endpoint. These keys are a non-standard approach to API authorization and are generally issued on a per-API basis.\n\nAn Access Token is also a string of characters but is a base-64 encoded JavaScript Object Notation Web Token, or JWT. JWTs are a widely accepted standard that use OAuth concepts and approaches. \n\nBoth API Keys and Access Tokens are used in an Authorization Request Header as a Bearer, meaning there is no difference in where you put this string of characters when you make calls to DTN APIs.\n## How to generate an Access Token?\nWhen requested, an Access Token is generated for your specific Client (ID/Secret) and for a specific API. The DTN Auth and Identity Service (DAIS) generates new Access Tokens for your client. The DAIS endpoint is `POST https://api.auth.dtn.com/v1/tokens/authorize`.\n\nThis endpoint takes two Header parameters:\n * `Content-Type: application/json`\n * `Accept: application/json`\n\nThis endpoint takes four parameters in the Request Body:\n * `grant_type`: this should always be client_credentials for generating machine-to-machine tokens.\n * `client_id`: this is the Client ID or Application ID using the token and is given to you by DTN's Identity Team. This ID will never change for your client/application.\n * `client_secret`: this is the Client Secret that is associated with the Application ID and is given to you by DTN's Identity Team. This key is subject to rotation for security purposes but always with the client's knowledge.\n * `audience`: this is the API for which this Access Token will be used. For the DTN Shipping API, you need to use the following audience: https://shipping.api.dtn.com\n\nYou can use this CURL command template as a reference for obtaining an access token:\n ```\n curl --location --request POST 'https://api.auth.dtn.com/v1/tokens/authorize' \\\n--header 'Accept: application/json' \\\n--header 'Content-Type: application/json' \\\n--data-raw '{\n\"grant_type\": \"client_credentials\",\n\"client_id\": \"insert your client id here\",\n\"client_secret\": \"insert your client secret here\",\n\"audience\": \"insert your audience here\"\n}' \n ```\n\n*This document, for demonstration purposes, supplies a client_id and client_secret in all code examples. This client/application is for a fictitious API and cannot be used in practice to gain unauthorized access to any other DTN API.*\nUpon generating a new Access Token, you should receive an HTTP Response from DAIS similar to this:\n ```\n {\n \"data\": {\n \"access_token\": \"eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6InpfX21pZW13NGhoTmdvQWQxR3N6ciJ9.eyJodHRwczovL2F1dGguZHRuLmNvbS9jdXN0b21lcklkIjoiMTIzNDU2Nzg5MERlbW8iLCJodHRwczovL2F1dGguZHRuLmNvbS9wcm9kdWN0Q29kZSI6IkRlbW9BcGlQIiwiaHR0cHM6Ly9hdXRoLmR0bi5jb20vcmVxdWVzdGVySXAiOiIxOC4yMTMuMTc0LjI3IiwiaHR0cHM6Ly9hdXRoLmR0bi5jb20vcnBzIjoiMTAwIiwiaHR0cHM6Ly9hdXRoLmR0bi5jb20vdGllciI6IkJhc2ljIiwiaHR0cHM6Ly9hdXRoLmR0bi5jb20vcXVvdGEiOiI5OTk5OTkiLCJpc3MiOiJodHRwczovL2lkLmF1dGguZHRuLmNvbS8iLCJzdWIiOiJuZnlPM0tpS1BSOE4wREtSNUNMOGpTOUdGQkNEZXlGTUBjbGllbnRzIiwiYXVkIjoiaHR0cHM6Ly9kZW1vLWFwaS5hdXRoLmR0bi5jb20vIiwiaWF0IjoxNjU2MDk5MDY4LCJleHAiOjE2NTYwOTkxNTgsImF6cCI6Im5meU8zS2lLUFI4TjBES1I1Q0w4alM5R0ZCQ0RleUZNIiwic2NvcGUiOiJyZWFkOmRlbW8gY3JlYXRlOmRlbW8gdXBkYXRlOmRlbW8iLCJndHkiOiJjbGllbnQtY3JlZGVudGlhbHMiLCJwZXJtaXNzaW9ucyI6WyJyZWFkOmRlbW8iLCJjcmVhdGU6ZGVtbyIsInVwZGF0ZTpkZW1vIl19.0VHdyp1w9PPFVI0FPheAwuKZwb5C25rwP-LPMXcSNoRmouvga1DZtNLA67ZzE_sAlc_VpaDRr6daLKr_Alw4347mw9sdjP8wKR27kCZa9JZK5PGQMmXHscATbzBEJYpCPklfyGaajgymqTBGnedcv8F0UvlRzQPsFeRPnVoX7BWOSXpMbyToGiXWkQLBQT7r96KAmLZOPJFZspPtjw-wH2mSL2WNa_nkB4j5vMGhGxlKiNRsKb30TH_WAel2hsxNlcPK3XHCmrMTYsNnu7HNqOTMn2i0__0rvBrhSWEw-_grqQDmWFJuWd7Qhi1q81AaJcdqgoSa_efz93QFclJUNw\",\n \"scope\": \"read:demo create:demo update:demo\",\n \"expires_in\": 90,\n \"token_type\": \"Bearer\"\n },\n \"meta\": {\n \"date_time\": \"2022-06-24T19:09:42.963Z\",\n \"name\": \"v1.tokens.authorize\",\n \"uuid\": \"ee6f9feb-dcf8-4421-a6fd-efd6beabdaa9\",\n \"start_timestamp\": 1656097782509,\n \"end_timestamp\": 1656097782963,\n \"execution_time\": 454\n }\n }\n ```\nLooking at this Response, you will see:\n * `access_token`: contains the JWT Access Token string you will use as your Bearer token.\n * `scope`: contains the scopes that this Access Token gives you permissions to access.\n * `expires_in`: contains the length of time before this Access Token will expire, in seconds.\n * `token_type`: verifies that this Access Token should be used as a Bearer token.\n\n## How to use an Access Token after one is generated?\nOnce a new Access Token is obtained, it is used in each call to a DTN API endpoint as a Bearer token in an Authorization Request Header. For example:\n ```\n Header: 'Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6InpfX21pZW13NGhoTmdvQWQxR3N6ciJ9.eyJodHRwczovL2F1dGguZHRuLmNvbS9jdXN0b21lcklkIjoiMTIzNDU2Nzg5MERlbW8iLCJodHRwczovL2F1dGguZHRuLmNvbS9wcm9kdWN0Q29kZSI6IkRlbW9BcGlQIiwiaHR0cHM6Ly9hdXRoLmR0bi5jb20vcmVxdWVzdGVySXAiOiIxOC4yMTMuMTc0LjI3IiwiaHR0cHM6Ly9hdXRoLmR0bi5jb20vcnBzIjoiMTAwIiwiaHR0cHM6Ly9hdXRoLmR0bi5jb20vdGllciI6IkJhc2ljIiwiaHR0cHM6Ly9hdXRoLmR0bi5jb20vcXVvdGEiOiI5OTk5OTkiLCJpc3MiOiJodHRwczovL2lkLmF1dGguZHRuLmNvbS8iLCJzdWIiOiJuZnlPM0tpS1BSOE4wREtSNUNMOGpTOUdGQkNEZXlGTUBjbGllbnRzIiwiYXVkIjoiaHR0cHM6Ly9kZW1vLWFwaS5hdXRoLmR0bi5jb20vIiwiaWF0IjoxNjU2MDk5MDY4LCJleHAiOjE2NTYwOTkxNTgsImF6cCI6Im5meU8zS2lLUFI4TjBES1I1Q0w4alM5R0ZCQ0RleUZNIiwic2NvcGUiOiJyZWFkOmRlbW8gY3JlYXRlOmRlbW8gdXBkYXRlOmRlbW8iLCJndHkiOiJjbGllbnQtY3JlZGVudGlhbHMiLCJwZXJtaXNzaW9ucyI6WyJyZWFkOmRlbW8iLCJjcmVhdGU6ZGVtbyIsInVwZGF0ZTpkZW1vIl19.0VHdyp1w9PPFVI0FPheAwuKZwb5C25rwP-LPMXcSNoRmouvga1DZtNLA67ZzE_sAlc_VpaDRr6daLKr_Alw4347mw9sdjP8wKR27kCZa9JZK5PGQMmXHscATbzBEJYpCPklfyGaajgymqTBGnedcv8F0UvlRzQPsFeRPnVoX7BWOSXpMbyToGiXWkQLBQT7r96KAmLZOPJFZspPtjw-wH2mSL2WNa_nkB4j5vMGhGxlKiNRsKb30TH_WAel2hsxNlcPK3XHCmrMTYsNnu7HNqOTMn2i0__0rvBrhSWEw-_grqQDmWFJuWd7Qhi1q81AaJcdqgoSa_efz93QFclJUNw'\n ```\n\n## Deconstructing the Access Token\nA DTN Access Token carries information within its JWT Body that is available on every API call. By deconstructing the JWT token, our Access Tokens will resemble:\n ```\n {\n \"https://auth.dtn.com/customerId\": \"1234567890Demo\",\n \"https://auth.dtn.com/productCode\": \"DemoApiP\",\n \"https://auth.dtn.com/requesterIp\": \"18.213.174.27\",\n \"https://auth.dtn.com/rps\": \"100\",\n \"https://auth.dtn.com/tier\": \"Basic\",\n \"https://auth.dtn.com/quota\": \"999999\",\n \"iss\": \"https://id.auth.dtn.com/\",\n \"sub\": \"nfyO3KiKPR8N0DKR5CL8jS9GFBCDeyFM@clients\",\n \"aud\": \"https://demo-api.auth.dtn.com/\",\n \"iat\": 1656099068,\n \"exp\": 1656099158,\n \"azp\": \"nfyO3KiKPR8N0DKR5CL8jS9GFBCDeyFM\",\n \"scope\": \"read:demo create:demo update:demo\",\n \"gty\": \"client-credentials\",\n \"permissions\": [\n \"read:demo\",\n \"create:demo\",\n \"update:demo\"\n ]\n }\n ```\n### Description of Claims\n\n | Claim | Type | Description |\n | -----------------------------------| --------------------------------------------| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n | `https://auth.dtn.com/customerId` | String | Custom DTN claim containing the Customer ID found in the DTN Order Management/Salesforce system associated with this token. |\n | `https://auth.dtn.com/productCode` | String | Custom DTN claim containing the Identity product code associated with this token. |\n | `https://auth.dtn.com/requesterIp` | String | Custom DTN claim containing the IP address of the requesting client. |\n | `https://auth.dtn.com/rps` | String | Custom DTN claim containing the maximum rate per second this customer is authorized to utilize. |\n | `https://auth.dtn.com/tier` | String | Custom DTN claim containing the data tier the customer purchased for the requested access. |\n | `https://auth.dtn.com/quota` | String | Custom DTN claim containing the maximum yearly quota the customer purchased for calling DTN endpoints for the specific product. |\n | `iss` | String (URI) | The Security Token Service (STS) that issues and returns the token. If this value is not from `https://id.auth.dtn.com/`, the token should not be considered trusted. |\n | `sub` | String (URI) | The principle about which the token asserts information (the User ID or Client ID within the Identity Provider). A User ID will start with a prefix of `auth0\\|`, while the Client ID will end with the suffix `@clients`. |\n | `aud` | String \\| Array (Strings) (URI \\| [URI, …]) | Identifies the intended recipient(s) of the token – its audience. The token should be rejected if the audience does not contain values expected by the calling application. |\n | `iat` | Number (Timestamp) | “Issued At” indicates when the authentication for this token occurred. |\n | `exp` | Number (Timestamp) | The “expiration time” on or after which the JWT must not be accepted for processing. |\n | `azp` | String | The application/client ID of the client using the token. The application can cat as itself or on behalf of a user. |\n | `gty` | String (Space-delimited) | The grant type that was used to request the token – not an RFC 7519 registered claim (Auth0-specific). |\n | `permissions` | Array (Strings) | The grant type that was used to request the token – not an RFC 7519 registered claim (Auth0-specific). |\n\n "}}},"tags":[{"name":"CustomerVesselSubscription","description":"Consists of http methods for managing customer vessel subscriptions."}]}