InvoicesGetInvoiceByExternalKey

GetInvoiceByExternalKey

Invoicing service 1.1: Finds the invoice an external system's key is mapped to and returns it - without lines.

ServiceInvoicing 1.1
EndpointPOST https://app{server-number}.timelog.com/{account}/WebServices/Invoicing/V1_1/InvoicingServiceSecure.svc
SOAPActionhttp://www.timelog.com/api/tlp/v1/InvoicingService/GetInvoiceByExternalKey
Content-Typetext/xml; charset=utf-8
AuthenticationA token from GetToken
Changes dataNo
Safe to retryYes

How it works

Looks up the mapping stored for INVOICES and returns that invoice. The match is exact on the key; the system must be registered on the account. The returned invoice is INCOMPLETE: InvoiceLines is empty, VATIncluded is 0, a draft's totals are the stored ones, and an overdue invoice can still say Booked. The invoice's external keys are loaded but not returned. Call GetInvoiceByGUID with the returned GUID for the full invoice.

Parameters

Each parameter has one label: Required, Conditional (required depending on other values) or Optional. Send them in the order shown.

externalKeystring
Required

The external system's key for the invoice, as stored by the mapping.

systemNamestring
Required

Name of the registered external system the key belongs to.

tokenSecurityToken
Required

The token from GetToken: Initials, Expires and Hash, sent back unchanged.

Request

POST /{account}/WebServices/Invoicing/V1_1/InvoicingServiceSecure.svc HTTP/1.1
Host: app{server-number}.timelog.com
Content-Type: text/xml; charset=utf-8
SOAPAction: "http://www.timelog.com/api/tlp/v1/InvoicingService/GetInvoiceByExternalKey"

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
                  xmlns:invoicing="http://www.timelog.com/api/tlp/v1"
                  xmlns:tok="http://www.timelog.com/api/tlp/v1_3">
  <soapenv:Body>
    <invoicing:GetInvoiceByExternalKey>
      <invoicing:externalKey>{externalKey}</invoicing:externalKey>
      <invoicing:systemName>{systemName}</invoicing:systemName>
      <invoicing:token>
        <tok:Initials>{Initials from GetToken}</tok:Initials>
        <tok:Expires>{Expires from GetToken, unchanged}</tok:Expires>
        <tok:Hash>{Hash from GetToken}</tok:Hash>
      </invoicing:token>
    </invoicing:GetInvoiceByExternalKey>
  </soapenv:Body>
</soapenv:Envelope>
Replace every {…} placeholder with your own value.

Response

The call returns the standard response envelope. Check ResponseState first: a failed call still returns HTTP 200.

ResponseStatestring
Required

Success, Invalid or Error.

ErrorCodeinteger

0 on success, otherwise the error code. See Errors.

ReturnInvoice[]

Response<Invoice>: Return[0] = the invoice WITHOUT lines, VATIncluded 0, stored totals and status. No 'Successfully called' message. Never empty on success - no single match is an error.

Example response

HTTP/1.1 200 OK
Content-Type: text/xml; charset=utf-8

<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
  <s:Body>
    <GetInvoiceByExternalKeyResponse xmlns="http://www.timelog.com/api/tlp/v1">
      <GetInvoiceByExternalKeyResult xmlns:a="http://api.timelog.com"
                                     xmlns:b="http://www.timelog.com/api/tlp/v1"
                                     xmlns:c="http://www.timelog.com/api/tlp/v1_1"
                                     xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
        <a:Return>
          <b:Invoice>
            <a:Action>Original</a:Action>
            <a:IsCustomFieldsLoaded>false</a:IsCustomFieldsLoaded>
            <a:CustomFields i:nil="true"/>
            <a:IsExternalKeysLoaded>false</a:IsExternalKeysLoaded>
            <a:ExternalKeys i:nil="true"/>
            <b:ID>1001</b:ID>
            <b:InvoiceNo>1001</b:InvoiceNo>
            <b:Header>Example</b:Header>
            <b:Message>Example</b:Message>
            <b:InvoiceDate>2026-10-01T00:00:00</b:InvoiceDate>
            <b:DueDate>2026-10-01T00:00:00</b:DueDate>
            <b:Status>Example</b:Status>
            <b:Type>Example</b:Type>
            <b:RequisitionNo>1001</b:RequisitionNo>
            <b:InvoicingAddress>
              <c:Address1>Example</c:Address1>
              <c:Address2>Example</c:Address2>
              <c:Address3>Example</c:Address3>
              <c:ZipCode>1000</c:ZipCode>
              <c:City>Copenhagen</c:City>
              <c:State>Example</c:State>
              <c:Country>DK</c:Country>
            </b:InvoicingAddress>
            <b:CustomerID>1001</b:CustomerID>
            <b:ContactID>1001</b:ContactID>
            <b:CustomerReference>Example</b:CustomerReference>
            <b:InternalReference>Example</b:InternalReference>
            <b:CalculateVAT>false</b:CalculateVAT>
            <b:NetAmount>0</b:NetAmount>
            <b:VATIncluded>0</b:VATIncluded>
            <b:Rounding>0</b:Rounding>
            <b:AmountDue>0</b:AmountDue>
            <b:InvoiceLines>
              <b:InvoiceLine>
                <a:Action>Original</a:Action>
                <a:IsCustomFieldsLoaded>false</a:IsCustomFieldsLoaded>
                <a:CustomFields i:nil="true"/>
                <a:IsExternalKeysLoaded>false</a:IsExternalKeysLoaded>
                <a:ExternalKeys i:nil="true"/>
                <b:ID>1001</b:ID>
                <b:InvoiceID>1001</b:InvoiceID>
                <b:Date>2026-10-01T00:00:00</b:Date>
                <b:ProductNo>1001</b:ProductNo>
                <b:Text>Example</b:Text>
                <b:Quantity>0</b:Quantity>
                <b:Rate>0</b:Rate>
                <b:Amount>0</b:Amount>
                <b:Discount>0</b:Discount>
                <b:InvoiceLineType>0</b:InvoiceLineType>
                <b:VAT>0</b:VAT>
                <b:Details>
                  <b:ProjectHeader i:nil="true"/>
                  <b:Comment>Example</b:Comment>
                </b:Details>
              </b:InvoiceLine>
            </b:InvoiceLines>
            <b:Currency>DKK</b:Currency>
            <b:EAN>Example</b:EAN>
            <b:InvoiceCurrencyRate>0</b:InvoiceCurrencyRate>
            <b:GUID>3f2504e0-4f89-41d3-9a0c-305000000001</b:GUID>
            <b:InvoicingAttention>Example</b:InvoicingAttention>
            <b:InvoicingCustomerName>Example invoicing customer</b:InvoicingCustomerName>
            <b:CustomerReferenceID>1001</b:CustomerReferenceID>
            <b:InvoiceNoExternal>Example</b:InvoiceNoExternal>
            <b:Details>
              <b:Status>
                <a:Action>Original</a:Action>
                <a:IsCustomFieldsLoaded>false</a:IsCustomFieldsLoaded>
                <a:CustomFields i:nil="true"/>
                <a:IsExternalKeysLoaded>false</a:IsExternalKeysLoaded>
                <a:ExternalKeys i:nil="true"/>
                <b:ID>1001</b:ID>
                <b:Name>Example </b:Name>
              </b:Status>
              <b:Type>
                <a:Action>Original</a:Action>
                <a:IsCustomFieldsLoaded>false</a:IsCustomFieldsLoaded>
                <a:CustomFields i:nil="true"/>
                <a:IsExternalKeysLoaded>false</a:IsExternalKeysLoaded>
                <a:ExternalKeys i:nil="true"/>
                <b:ID>1001</b:ID>
                <b:Name>Example </b:Name>
              </b:Type>
              <b:InternalReference>
                <c:ID>1001</c:ID>
                <c:Initials>ABC</c:Initials>
                <c:FullName>Example full</c:FullName>
              </b:InternalReference>
              <b:Currency>
                <c:ID>1001</c:ID>
                <c:Abbreviation>DKK</c:Abbreviation>
                <c:Rate>0</c:Rate>
                <c:RateDate>2026-10-01T00:00:00</c:RateDate>
                <c:DescriptiveName>Example descriptive</c:DescriptiveName>
              </b:Currency>
              <b:CustomerHeader>
                <c:ID>1001</c:ID>
                <c:Name>Example </c:Name>
                <c:No>1001</c:No>
                <c:GUID>3f2504e0-4f89-41d3-9a0c-305000000002</c:GUID>
              </b:CustomerHeader>
              <b:ContactHeader>
                <c:GUID>3f2504e0-4f89-41d3-9a0c-305000000003</c:GUID>
                <c:FirstName>Example first</c:FirstName>
                <c:LastName>Example last</c:LastName>
              </b:ContactHeader>
              <b:ProjectHeader>
                <c:ID>1001</c:ID>
                <c:Name>Example </c:Name>
                <c:No>1001</c:No>
                <c:IsActive>true</c:IsActive>
                <c:IsGeneralProject>false</c:IsGeneralProject>
                <c:StartDate>2026-10-01T00:00:00</c:StartDate>
                <c:EndDate>2026-10-01T00:00:00</c:EndDate>
              </b:ProjectHeader>
            </b:Details>
          </b:Invoice>
        </a:Return>
        <a:ReturnTypeDescription>Invoice</a:ReturnTypeDescription>
        <a:Request>…</a:Request>
        <a:ResponseState>Success</a:ResponseState>
        <a:Messages>
          <a:APIMessage>
            <a:Message>Duration of call was 0,0421337 sec.</a:Message>
            <a:Severity>Message</a:Severity>
            <a:ErrorCode>0</a:ErrorCode>
          </a:APIMessage>
        </a:Messages>
        <a:ErrorCode>0</a:ErrorCode>
        <a:IsReturnPaged>false</a:IsReturnPaged>
        <a:TotalPageCount>0</a:TotalPageCount>
      </GetInvoiceByExternalKeyResult>
    </GetInvoiceByExternalKeyResponse>
  </s:Body>
</s:Envelope>
Illustrative example: built from the service description (WSDL) in the same format as a real response, with made-up values. The Request block is shortened.

Errors

All errors come back with HTTP 200: check ResponseState, ErrorCode and Messages. The errors every operation can return (expired or invalid token, API not enabled, HTTPS required, general errors) are listed once in Responses and errors.

Errors specific to this operation:

ResponseStateErrorCodeMessageWhat it meansWhat to do
Error40001Error during call on TimeLog.API, Message 'Invoice not found (Key: "{externalKey}", SystemName: "{systemName}"'No mapping, more than one invoice mapped to the key, or the system name does not match.—
Error40001Error during call on TimeLog.API, Message 'Unable to retrieve invoiceDTO with GUID:{guid}
In Stored Procedure: …'The mapping points at an invoice GUID that no longer exists.Check the GUID.