---
updatedAt: 2026-09-04T12:35:14.000Z
agentTools:
  projectIndex: https://docs.shipscience.com/llms.txt
---

# Generate token

Issue a short-lived JWT bearer token for the requesting account. Authentication
for this endpoint uses the `api-key` header (not bearer auth). The returned
token is valid for 4 hours; clients should refresh before expiry. Use the
returned `jwt` in the `Authorization: Bearer <token>` header on all other
endpoints.


# OpenAPI definition

```json
{
  "openapi": "3.0.1",
  "info": {
    "title": "Shipscience API",
    "version": "v1",
    "description": "ShipScience's REST API for partners and customers.\n\n## Authentication\n\nMost endpoints require a bearer JWT in the `Authorization` header. Tokens\nare issued by the ShipScience login flow and are valid for 4 hours.\nClients are responsible for refreshing tokens before expiry. The\n`/api/v1/tokens` endpoint is an exception — it authenticates with the\n`api-key` header rather than a bearer JWT, since its purpose is to\nissue the JWT itself.\n\n## Partner endpoints\n\nThe **Sub Accounts** section is only available to accounts explicitly\nenabled as partners. If you receive `403 Forbidden`, contact\n**support@shipscience.com** to request access.\n"
  },
  "tags": [
    {
      "name": "Authentication",
      "description": "Endpoints for issuing API tokens. Most ShipScience API endpoints require a\nbearer JWT in the `Authorization` header. Tokens are issued by `POST /api/v1/tokens`\nusing your account's `api-key` and are valid for 4 hours. Refresh before expiry.\n"
    }
  ],
  "paths": {
    "/api/v1/tokens": {
      "post": {
        "summary": "Generate token",
        "tags": [
          "Authentication"
        ],
        "description": "Issue a short-lived JWT bearer token for the requesting account. Authentication\nfor this endpoint uses the `api-key` header (not bearer auth). The returned\ntoken is valid for 4 hours; clients should refresh before expiry. Use the\nreturned `jwt` in the `Authorization: Bearer <token>` header on all other\nendpoints.\n",
        "security": [
          {
            "api_key_auth": []
          }
        ],
        "responses": {
          "200": {
            "description": "successful",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/token"
                }
              }
            }
          },
          "401": {
            "description": "unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/error"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "error": {
        "type": "object",
        "properties": {
          "error": {
            "type": "object",
            "properties": {
              "message": {
                "type": "string"
              }
            }
          }
        }
      },
      "token": {
        "type": "object",
        "properties": {
          "jwt": {
            "type": "string"
          }
        }
      }
    },
    "securitySchemes": {
      "api_key_auth": {
        "type": "apiKey",
        "name": "api-key",
        "in": "header"
      }
    }
  },
  "servers": [
    {
      "url": "https://app.shipscience.com",
      "variables": {
        "defaultHost": {
          "default": "app.shipscience.com"
        }
      }
    }
  ]
}
```